Dear friend
Last day one of my friend who was appearing in RHCE exam face a problem in troubleshooting section
That he was unable to modify /etc/passwd file
then i suggest him to use
lsattr /etc/passwd
then he find
----i-------- /etc/passwd
& then he use
chattr -i /etc/passwd
so i am posting syntax & attributes for chattr command
SYNTAX & COMMAND FOR CHATTR
chattr - change file attributes on a Linux second extended file system
SYNOPSIS
chattr [ -RV ] [ -v version ] [ mode ] files...
DESCRIPTION
chattr changes the file attributes on a Linux second extended file system.
OPTIONS
-R
Recursively change attributes of directories and their contents. Symbolic links encountered during
recursive directory traversals are ignored.
-V
Be verbose with chattr's output and print the program version.
-v version
Set the file's version/generation number.
Opcodes
+
Add attribute.
-
Remove attribute.
=
Assign attributes (removing unspecified attributes).
ATTRIBUTES
1) A file with the `i' attribute cannot be modified: it cannot be deleted or renamed, no link can be
created to this file and no data can be written to the file. Only the superuser or a process pessessing
the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
2) A file with the `j' attribute has all of its data written to the ext3 journal before being written to
the file itself, if the filesystem is mounted with the "data=ordered" or "data=writeback" options. When
the filesystem is mounted with the "data=journalled" option all file data is already journalled and this
attribute has no effect. Only the superuser or a process possessing the CAP_SYS_RESOURCE capability can
set or clear this attribute.
3) When a file with the `s' attribute set is deleted, its blocks are zeroed and written back to the disk.
4) When a file with the `S' attribute set is modified, the changes are written synchronously on the disk;
this is equivalent to the `sync' mount option applied to a subset of the files.
5) When a file with the `u' attribute set is deleted, its contents are saved. This allows the user to ask
for its undeletion.
6) A file with the `a' attribute set can only be open in append mode for writing. Only the superuser or a
process pessessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
7) A file with the `c' attribute set is automatically compressed on the disk by the kernel. A read from
this file returns uncompressed data. A write to this file compresses data before storing them on the
disk.
8) When a directory with the `D' attribute set is modified, the changes are written synchronously on the
disk; this is equivalent to the `dirsync' mount option applied to a subset of the files.
9) A file with the `d' attribute set is not candidate for backup when the "dump" program is run.
Last day one of my friend who was appearing in RHCE exam face a problem in troubleshooting section
That he was unable to modify /etc/passwd file
then i suggest him to use
lsattr /etc/passwd
then he find
----i-------- /etc/passwd
& then he use
chattr -i /etc/passwd
so i am posting syntax & attributes for chattr command
SYNTAX & COMMAND FOR CHATTR
chattr - change file attributes on a Linux second extended file system
SYNOPSIS
chattr [ -RV ] [ -v version ] [ mode ] files...
DESCRIPTION
chattr changes the file attributes on a Linux second extended file system.
OPTIONS
-R
Recursively change attributes of directories and their contents. Symbolic links encountered during
recursive directory traversals are ignored.
-V
Be verbose with chattr's output and print the program version.
-v version
Set the file's version/generation number.
Opcodes
+
Add attribute.
-
Remove attribute.
=
Assign attributes (removing unspecified attributes).
ATTRIBUTES
1) A file with the `i' attribute cannot be modified: it cannot be deleted or renamed, no link can be
created to this file and no data can be written to the file. Only the superuser or a process pessessing
the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
2) A file with the `j' attribute has all of its data written to the ext3 journal before being written to
the file itself, if the filesystem is mounted with the "data=ordered" or "data=writeback" options. When
the filesystem is mounted with the "data=journalled" option all file data is already journalled and this
attribute has no effect. Only the superuser or a process possessing the CAP_SYS_RESOURCE capability can
set or clear this attribute.
3) When a file with the `s' attribute set is deleted, its blocks are zeroed and written back to the disk.
4) When a file with the `S' attribute set is modified, the changes are written synchronously on the disk;
this is equivalent to the `sync' mount option applied to a subset of the files.
5) When a file with the `u' attribute set is deleted, its contents are saved. This allows the user to ask
for its undeletion.
6) A file with the `a' attribute set can only be open in append mode for writing. Only the superuser or a
process pessessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
7) A file with the `c' attribute set is automatically compressed on the disk by the kernel. A read from
this file returns uncompressed data. A write to this file compresses data before storing them on the
disk.
8) When a directory with the `D' attribute set is modified, the changes are written synchronously on the
disk; this is equivalent to the `dirsync' mount option applied to a subset of the files.
9) A file with the `d' attribute set is not candidate for backup when the "dump" program is run.
No comments:
Post a Comment