Using the chmod command to change file permissions on a UNIX/Linux system.
-rw-rw-r-- 1 john john 203 09-02-12 07:16 pm out.out |
This file listing detail shows the information about the current file. The listing -rw-rw-r– shows the permissions for user, group and world. In this example, the user has read and write access, the group has read and write access and the world has read only access.
With this command, I am setting the permissions to -rw——-.
chmod 600 out.out |
This example sets the permissions to -rw-r–r–.
chmod 644 out.out |
To set the file as executable this command will perform this action, -rwx——.
chmod 700 out.out |
if you wish to have the file executable and readable for the group, -rwxr–r–, this command will make this possible.
chmod 744 out.out |
To make the file executable for everyone, like this: -rwxr-xr-x.
chmod 755 out.out |
This is quite a malicious and pointless command, this will make the file executable but not readable for anyone.
chmod -rw-rw-rw-- out.out |
The result is this.
john@deep-thought Documents $ ls -hula out.out ---x--x--x 1 john john 203 09-02-12 09:41 pm out.out |
Using the command line is faster than the GUI interface if you are setting permissions for multiple files at once. This is why the UNIX command line that Linux inherited is better than the graphical user interface any day.