Only the owner and root can change permissions for a file or directory.
The easiest way of changing permissions from the command line is to use the command $ chmod and specify the new permissions as a binary number.
Permissions written as rwxrw-r-- can also be written as a binary number.
For example: -rwxrw-r-- 1 user group 55 2009-09-29 20:43 filename
can be written as:
-111110100 1 user group 55 2009-09-29 20:43 filename
Where rw-r-xr-- = 110101100
The binary is split into three parts: 110 101 100
And each part is summed using binary math:
When summed: rw-r-xr-- = 110101100 = 654
Now change file permissions with $ chmod
$ chmod 411 filename will change permissions to r----x--x
$ chmod -R 411 dirname Will change permissions recursively for all files in a directory, including subfolders.
It is also possible use chmod with letters to represent the permissions. Read is r , write is w and execute is x
$ chmod g+r filename Will give read permission to group.
To remove a permission, replace + with -
$ chmod g-x filename Will take away execute permission from group.
Use a for all, u for user, g for group and o for others.
Home | Contact | Debian OS | OpenStudio arkitekter