2012-10-15

How to set permissions for Linux personal web site

Let's suppose that we have a user account located at ~ and a web site at ~/www

We need to set the directory permissions to 755 allow every

We need to set the files to 644 (owner can r/w, everybody else can r)
    u g w
0 - 0 0 0
1 - 0 0 1
2 - 0 1 0
3 - 0 1 1
4 - 1 0 0
5 - 1 0 1
6 - 1 1 0
7 - 1 1 1
u stands for 'user', g for 'group' and w for 'world'.
These are the classic Unix file permissions.

However, if AFS is being used, we also need to provide permissions in the access control lists (ACL).

The following command gives access to the web folder to anyone:

fs sa www system:anyuser rl

The following lists the existing permissions:

fs la www

More help on AFS
"
There are seven standard AFS permissions, each referred to by one of the letters r, l, i, d, w, k and a. The lida permissions apply to directories and the rwk permissions apply to files.
Directory permissions

l (lookup)
Allows one to list the contents of a directory. It does not allow the reading of files.
i (insert)
Allows one to create new files in a directory or copy new files to a directory.
d (delete)
Allows one to remove files and sub-directories from a directory.
a (administer)
Allows one to change a directory's ACL. The owner of a directory can always change the ACL of a directory that s/he owns, along with the ACLs of any subdirectories in that directory.

File permissions

r (read)
Allows one to read the contents of file in the directory.
w (write)
Allows one to modify the contents of files in a directory and use chmod on them.
k (lock)
Allows programs to lock files in a directory.

"

No comments: