Can you provide more information about chmod command octal mode number notation?
The command chmod changes the file mode bits of each given file according to mode, which can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the new mode bits. chmod never changes the permissions of symbolic links; the chmod system call cannot change their permissions. This is not a problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line, chmod changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic links encountered during recursive directory traversals.
UNIX / Linux chmod command
A bit mask created by ORing together zero or more of the following:
| Octal Mode Number | Description |
|---|---|
| 0400 | Allows the owner to read |
| 0200 | Allows the owner to write |
| 0100 | Allows the owner to execute files and search in the directory |
| 0040 | Allows group members to read |
| 0020 | Allows group members to write |
| 0010 | Allows group members to execute files and search in the directory |
| 0004 | Allows everyone or the world to read |
| 0002 | Allows everyone or the world to write |
| 0001 | Allows everyone or the world to execute files and search in the directory |
| 1000 | Sets the sticky bit |
| 2000 | Sets the setgid bit |
| 4000 | Sets the setuid bit |
First digit in the above mode number is used to set setuid, setgid, or sticky bit. Each remain digit set permission for the owner, group, and world as follows:
- 4 = r (Read)
- 2 = w (Write)
- 1 = x (eXecute)
So you end up creating the triplets for your user by adding above digits. For e.g.
- To represent rwx triplet use 4+2+1=7
- To represent rw- triplet use 4+2+0=6
- To represent r-- triplet use 4+0+0=4
- To represent r-x triplet use 4+0+1=5
To only give full permission to user, use it as follows:
chmod 0700 file.txt
- 0 - Use set setuid, setgid, or sticky bit
- 7 - Full permission for owner (rwx = 4+2+1=7)
- 0 - Remove group permission (--- = 0+0+0=0)
- 0 - Remove world permission (--- = 0+0+0=0)
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop













{ 5 comments… read them below or add one }
To represent r-x triplet use 4+0+1=1 – It should be 5, not 1. :-)
@Tsakos,
Thanks for the heads up!
Thank you. It opened my eyes wide.
Very Good Explanation It helps me a lot
what are the permissions for the chmod 000 hari consider the hari file was exited