Each file in UNIX or Linux has the nine permission bits as follows:
ls -l /etc/hostsSample outputs:
-rw-r--r-- 1 root root 401 2009-12-20 12:08 /etc/hostsThe Entry Type
There are total 10 bits -rw-r--r--:The file mode printed under the -l option consists of the entry type (1st bit) and the permissions (9 bits). The entry type character describes the type of file, as follows:
- - Regular file.
- b Block special file (stored in /dev).
- c Character special file (stored in /dev).
- d Directory.
- l Symbolic link.
- p FIFO.
- s Socket.
- w Whiteout.
Examples
Show directory type with the ls command:ls -ld /etcSample outputs:
drwxr-xr-x 170 root root 12288 2010-02-24 11:39 /etcShow block device type (hard disk) with the ls command:ls -l /dev/sdaSample outputs:
brw-rw---- 1 root disk 8, 0 2010-02-24 11:32 /dev/sdaThe Permissions Bits
The next three fields are three characters each for- File owner permissions
- File group permissions
- Other permissions (not part of both owner or group)
- r : The file is readable; if - it is not readable.
- w : the file is writable; if -, it is not writable.
- S : If in the owner permissions, the file is not executable and set-user-ID mode is set. If in the group permissions, the file is not executable and set-group-ID mode is set.
- s : If in the owner permissions, the file is executable and set-user-ID mode is set. If in the group permissions, the file is executable and set group-ID mode is set.
- x : The file is executable or the directory is searchable.
- - : The file is neither readable, writable, executable, nor set-user-ID nor set-group-ID mode, nor sticky.
- T The sticky bit is set (mode 1000), but not execute or search permission.
- t The sticky bit is set (mode 1000), and is searchable or executable.
No comments:
Post a Comment