next up previous contents
Next: File and Filesystem Up: File ownership and permission Previous: File ownership and permission

How:

In this example, we use the file_ownership directory under your personal home directory.

Check file/directory permission:

tabular97

[yuni@lovely-linux yuni]$ cd file_ownership
[yuni@lovely-linux file_ownership]$ ls -lR .
-rw-------    1 yuni    yuni    657 Jul 12 10:04 bashrc

./sub_dir_1:
total 25
drwx------    2 yuni    yuni    512 Jul 12 10:04 ./
drwx--x--x  251 yuni    yuni  24064 Jul 12 10:04 ../
-rw-------    1 yuni    yuni    608 Jul 12 10:04 fstab

Both files bashrc and fstab are read-writable by the owner herself. The directory sub_dir_1 is read-writable and executable by the owner herself. The executable permission is needed for directory to be accessible.

To grant read access of fstab to every users in the system, you need to:

  1. Grant others read access to fstab.
  2. Grant others executable permission to sub_dir_1.

tabular111

Check new file permission:

[yuni@lovely-linux file_ownership]$ ls -lR .
-rw-------    1 yuni    yuni    657 Jul 12 10:04 bashrc

./sub_dir_1:
total 25
drwx--x--x    2 yuni    yuni    512 Jul 12 10:04 ./
drwx--x--x  251 yuni    yuni  24064 Jul 12 10:04 ../
-rw-r--r--    1 yuni    yuni    608 Jul 12 10:04 fstab

For detailed usage of chmod command, see manpage.

In the above example, "a+x" and "a+r" mean all (a), i.e. user, group, and other, add (+), executable (x) and readable (r). Effectively, they grant executable permission to all users and read permission to all users respectively.

The alternative as shown above use numbers instead of symbolic mode specification. The number 711 and 644 should be read as 3-digit numbers. The 3 digits refer to the desired permission for owner, group and others respectively represented in binary number form.

tabular142



System Administrator
Thu Jul 26 11:24:05 HKT 2001