On a POSIX filesystem, every file has a user (the file's owner), a group, and permissions for the user, the group, and everyone else.
For every user, access to a given file is determined as follows:
- if the user is the file's owner, the owner permissions apply;
- if the user is a member of the file's group, the group permissions apply;
- in all other cases, the other permissions apply.
The order here is significant; thus you can have a file which is owned by you, with permissions 0077
(everything for the group and others, nothing for the owner), and you will not have access to it! But since you're the owner you can change that with chmod
. This can be useful in some cases where you want to deny access to a specific group and allow anyone else access (think of a students
group in an academic context).
Strictly speaking permissions aren't matched to the end user, but to a process's effective user, which may be different (e.g. for set-uid binaries). There can also be other factors affecting groups, e.g. on NFS mounts.
Permissions can be set with chmod
(see Understanding UNIX permissions and their attributes for details), and one option is to use the letter you mention: u
for the user permissions, g
for the group permissions, and o
for other permissions. Using a
with chmod
applies the permissions to all three categories.
In modern systems other access permissions can apply on top of or instead of these permissions; look up ACLs (setfacl
), SELinux etc.