![]() |
Webmaster
Workshop The Beginner's Guides Section |
|
Front Page Forums Contact Us Terms of Use How To Guides Resource Center |
|
|
GUIDES
GENERAL
SCRIPTING Beginners Guide to Telnet Basic UNIX Commands CHMOD and setting permissions Guide Basic guide to CRONTAB Basic Guide to Paths |
CHMOD and PERMISSIONS GUIDE Permissions are perhaps one of the most confusing
issues that confronts the newcomer to script installation. One of the most frequently things causing scripts not to perform properly on installation is wrongly set permissions. This guide will firstly set out
permissions and what they do If you understand permission values and want a guide to chmod jump to here FIRSTLY: There are three types of permissions these are read write and execute.
SECONDLY: There are three groups of permissions user, group and world
Using FTP you are often presented with a dialogue box like below
This Means: The user can read, write and execute this file and the group and world can just read and execute this file. Now you will find quite often reference to
setting permissions to either a number or a group of letters.
Firstly let's tackle the numbers
This then is translated by adding the values together for each of the groups of permissions. Therefore if setting permissions for the file as in the Table above
Therefore the permission in this case would be 755 If the group could write as well read and execute Group would = 4+2+1 =7 Therefore the permission would be 775 IF
SECONDLY: let's tackle the letters Basically this is the same as the numbers but using letters instead of numbers
So to set permission to 765 as above it would translate to rwx rw- r-x OR to
set to
777
rwx rwx rwx 644 meaning owner can read and write and group and world can read only If you fully understand the above you can now move onto the chmod command. We will start with the easier way by using numbers to set permissions chmod 777 example.html will set the file named example in the current directory to read write and execute for everyone chmod 755 *.cgi will set all the files with the extension cgi in the current directory to read write and execute for the user read and execute for the group and world. chmod 777 directory will set the permissions for all files and sub directories of the directory named directory to read, write and execute for everyone. Working with letters is slightly more complicated and is detailed below. Besides the letters relating to the permissions r w x see above click here there is another set of letters relating to sets of permissions
Permissions are granted with the following operators
Format chmod usr|grp|othr operator permission EXAMPLES: chmod ugo=rwx filename This would assign the file filename in the current directory read write and execute permissions to the user group and others (world) (777) chmod u=rwx,go=rx filename This would assign the file filename in the current directory read write and execute permission for the user and read and execute only for the group and world (755) chmod go= filename This would clear all permissions for group and the world for the file filename chmod o-x *.cgi This would remove execute permission for the world for all files with the extension cgi chmod u=rwx,go=r directory This would set the directory named directory and all files and subdirectories in it to user read write and execute the group and world to read only (744) chmod go+w directory This would add write permission for the group and world to the directory named directory and all the files and subdirectories in it
Back to Unix Command Guide Back to Guides Home Page
|
|
This
site design and content is © Copyright 2000-2005 by |