The following is a simple explanation of file permissions in Unix. To list the access permissions of a file or directory, SSH to your server, then cd directoryname to change the directory until you are either in the directory above the file you are interested in or above the directory you are checking. If you enter the ls -l filename, you will see what the current permission settings are for that file along with other information about the file.
Using chmod
People | Permissions |
u = the file's user (you) | r = read access |
g = the file's group | w = write access |
o = others | x = execute access |
a = the user, the group, and others |
In our VPS environment, there are only two users: root (our system administrators), and you. This means that you are the only user in the 'group' category. Additionally, there isn't anybody who has access to your VPS that falls in the 'other' (also commonly referred to as 'world') category. You won't need to consider the 'other' category when setting the permissions of your files and folders.
To change permissions for a file named filename.cgi, you need to chmod the file (change mode). For example, when you type chmod u=rwx,g=rx,o=rx filename.CGI, you've given:
- read, write, and execute access to the user (that's you)
- read and execute access to the group
- read and execute access to others
For example, some scripts will tell you to chmod 755. Doing the above is the same thing as typing chmod 755. You can use either method with our Unix servers. So when you use the numeric system, the code for permissions is r = 4 w = 2 x = 1 rwx = 7. The first 7 of our chmod 755 tells Unix to change the user's permissions to rxw (because r=4 + w=2 + x=1 adds up to 7). The first 5 applies to the group, and the last 5, refers to others (4+1=5).
When doing an ls -l on the file, SSH always shows the permissions as -rwxr-xr-x. Ignore the first dash, then break up the above into three groups of letters. If there's a dash where a letter should be, it means that there is no permission for those people. Remember, the first 3 apply to the user, the second 3 apply to the group, and the third 3 apply to others.
Changing Permissions with FileZilla
- Highlight the file you wish to change the permissions on by left-clicking it once.
- Right-click the highlighted file.
- Click File Attributes... from the menu.
- You can now click the Read, Write, and Execute boxes for the Owner, Group, and Public sections of the Change File Attributes dialogue box.
- Alternatively, you can also set a numeric permission value in the Numeric value box (i.e. 755).
- Click OK to save your settings.
Changing Permissions with SmartFTP
- Highlight the file you wish to change the permissions on by left-clicking it once.
- Right-click the highlighted file.
- Click Properties / CHMOD from the menu.
- You can now click the Read, Write, and Execute boxes for the User, Group, and Others sections of the Properties dialogue box.
- Alternatively, you can also set a numeric permission value in the Permissions box (i.e. 755).
- Click OK to save your settings.
Changing Permissions with Fetch
- Highlight the file you wish to change the permissions on by clicking it once.
- Under the Remote menu, select Change Permissions.
- You can now click on the Read, Write, and Execute boxes to change permissions as needed.
- Click OK to save your settings.