connersamson
10-12-2001, 10:46 AM
I am trying to learn file permissions in Linux and want to change them for a directory to be used with ftp. Can someone give me a list of the possible file permissions, i.e. write, read, delete, etc. and their abbreviations. Also the command to change them with. Thanks.
Joeri Sebrechts
10-12-2001, 11:16 AM
The command to change them is called chmod.
It takes arguments of the form [ugoa][+=-][rwxstugo]
In the ugoa part u stands for user, g for group, o for others and a for all. So if you'd want a chmod command to apply to you and your group, you'd start the argument list with 'ug', without the quotes.
Then you say whether you want to add permissions (+), remove persmission (-), or set permissions to that of another group (=), without group being one of [ugo].
Then the permissions that matter are r for read, w for write and x for execute. So suppose you'd want to add read and execute permissions for yourself and the group you're in, you'd use this command:
chmod ug+rx filename
If you'd want to take away write permissions for everyone to a certain file (including yourself you'd use:
chmod a-w filename
The + and - are to add and remove permissions. If you want to set permission equal to something, use =. To set permissions for the others (not you and not people in your group) to read and execute a file use this:
chmod o=rx filename
If you want a chmod command to apply to a directory and all the files inside it, use the -R option so it will act recursive.
The s and t permissions are less used. s if for setuid (which means, execute this file as another user or group, depending on whether you add the s permission to the user or to the group), and the sticky bit (t) is interpreted in various ways on various systems, and can basically be ignored.
Anyway, for more information, check out 'man chmod'
Btw, to disallow deleting (or creating) a file, you have to disallow writing to the directory it's in.
[ 12 October 2001: Message edited by: Joeri Sebrechts ]