Viewing permissions
$ ls -l
Changing permissions
chmod who=permissions filename
eg
$ chmod g=rx filename $ chmod o=rx filename //adding write permission $ chmod g+w filename //removing write permission chmod a-w filename
Copying permissions
$ chmod g=u filename
Numeric method
$ chmod xxx filename $ chmod 755 filename //recursive $ chmod -R 777 foldername
Permission Groups :
- u – Owner
- g – Group
- o or a – All Users
Permission Types :
- r – Read
- w – Write
- x – Execute
Binary References
- r = 4
- w = 2
- x = 1
Value | Meaning |
777 | (rwxrwxrwx) No restrictions on permissions. Anybody may do anything. Generally not a desirable setting. |
755 | (rwxr-xr-x) The file’s owner may read, write, and execute the file. All others may read and execute the file. This setting is common for programs that are used by all users. |
700 | (rwx——) The file’s owner may read, write, and execute the file. Nobody else has any rights. This setting is useful for programs that only the owner may use and must be kept private from others. |
666 | (rw-rw-rw-) All users may read and write the file. |
644 | (rw-r–r–) The owner may read and write a file, while all others may only read the file. A common setting for data files that everybody may read, but only the owner may change. |
600 | (rw——-) The owner may read and write a file. All others have no rights. A common setting for data files that the owner wants to keep private. |