How do I change file permissions? (chmod)
Posted on 24 October 2003 05:52 PM
Change Mode: AutomagicallyYou may change the permissions of any file or directory within your account using your CNC. Once inside your CNC, click on the File Manager menu option. From there, navigate to the file(s) or directory you would like to change the permissions on and check the box next to it, scroll down to the bottom of the list and select the Change Mode button from the Command Menu. Select the desired permissions and click the Change button. That's it! (As a shortcut, you can also just click the permissions link under the Attributes column for the file you wish to change.)
chmod = change mode = set the permissions
|r||read the file or directory|
|w||write to the file or directory|
|x||execute the file or search the directory|
Each of these permissions can be set for any one of three types of user:
|u||the user who owns the file (usually you)|
|g||members of the group to which the owner belongs|
|o||all other users|
The access permissions for all three types of user can be given as a string of nine characters:
|r w x||r w x||r w x|
|r read||read a file||list files in ...|
|w write||write a file||create file in ...
rename file in ...
delete file ...
|x execute||execute a
|read a file in ...
write to a file in ...
execute a file in ...
execute a shell script in ...
Setting access permissions numerically
There is a shorthand way of setting permissions by using octal numbers. Read permission is given the value 4, write permission the value 2 and execute permission 1.
These values are added together for any one-user category:
|3||=||write and execute (1+2)|
|5||=||read and execute (4+1)|
|6||=||read and write (4+2)|
|7||=||read and write and execute (4+2+1)|
So access permissions can be expressed as three digits. For example:
|chmod 640 file1||rw-||r--||---|
|chmod 754 file1||rwx||r-x||r--|
|chmod 664 file1||rw-||rw-||r--|
Note: When installing scripts and the script author instructs you to set the permissions to mode 777, do not do this. It will not work on the FutureQuest servers. Anytime you are instructed to set the permissions to a script to 777 or 775, change them to 755 instead. Due to the way the servers are set up, mode 755 will work and offer you more security at the same time.