Changing file permissions
To change a file's permissions, you need to use a program called chmod. With that command you can change one or multiple file permissions. Here are a few examples:
$ chmod 755 file | ||||||
$ ls -l file | ||||||
-rwxr-xr-x 1 root |
users |
1656 |
Mar |
22 |
00:27 |
file |
$ chmod 700 file | ||||||
$ ls -l file | ||||||
-rwx------ 1 root |
users |
1656 |
Mar |
22 |
00:27 |
file |
$ chmod 664 file | ||||||
$ ls -l file | ||||||
-rw-rw-r-- 1 root |
users |
1656 |
Mar |
22 |
00:27 |
file |
The numbers are based on the 3 types of permissions. Read = 4, write = 2 and execute = 1. A permission of 755 means the user will have read, write and execute permissions (4 + 2 + 1 = 7), and everyone else will have read and execute permissions (4 + 1 = 5).