chmod
chmod ?
chmod is the command and system call, in Unix-like operating systems,which may change the access permissions to file system objects (files and folders).
chmod 755 /var/example/
will set 755 (drwxr-xr-x) on /var/example/
chmod -R 755 /var/example/
will set 755 (drwxr-xr-x) recursively on /var/example/ and his content.
Want to know more about chmod ?
Take a look on wikipedia.org / Chmod or, on you system
chmod --help
man chmod
How to know the rights of file or a folder ?
Use the ls command.
ls -l /var/
list all files and directory in /var/, the -l is to show rights, weight (...) and others informations.
Take a look on the help or the manual for more informations (RTFM).ls --help
man ls
This tools is really complete ?
Nope, not really, there are some options to chmod we didn't see with this tool. For more information, you can check some good source like
wikipedia.org / Chmod,
wikipedia.org / File_system_permissions
can there be more than 3 digits ?
Yep, there may be one other digits coming first, like 755 become 0755. Depends of sticky, SUID -setuid- and GUID -setgid-, take a look on the next point of this FAQ.
There is some other letters than xrc ?
Yep, there may be other letters when you look at the rights of your files and folders.
-
The first letter, other than -
d---------
is for a Directory.l---------
is for a symbolic Link.c---------
is for a Character special file.b---------
is for a Block special file.p---------
is for a FIFO (Pipe).s---------
is for a Socket.
-
---------t
---------T
Sticky Bit, short story, this right disallow any right to delete a file, wathever the parent directory rights, if the user who want to delete the file is not root or the owner of the file. wikipedia.org / Sticky_bit. -
---s------
---S------
------s---
------S---
are about SUID -setuid- and GUID -setgid-, this are some specifics rights allowing to "bypass" some rights with the rights of a the owner or the group. Take a look at wikipedia.org / Setuid for a better explanations.