Permissions Topic
Permissions Topic
Users
Every user is assigned a unique User ID number (UID)
o UID 0 identifies root
Users' names and UIDs are stored in /etc/passwd
Users are assigned a home directory and a program that is run
when they log in (usually a shell)
Users cannot read, write or execute each others' files without
permission
Groups
Users are assigned to groups
Each group is assigned a unique Group ID number (gid)
GIDs are stored in /etc/group
Each user is given their own private group
o Can be added to other groups for additional access
All users in a group can share files that belong to the group
Permission Precedence
If UID matches, user permissions apply
Otherwise, if GID matches, group permissions apply
If neither match, other permissions apply
Permission Types
Four symbols are used when displaying permissions:
o r: permission to read a file or list a directory's
contents
o w: permission to write to a file or create and
remove files from a directory
o x: permission to execute a program or change into
a directory and do a long listing of the directory
o -: no permission (in place of the r, w, or x)
Examining Permissions
File permissions may be viewed using ls -l
$ ls -l /bin/login
-rwxr-xr-x 1 root root 19080 Apr 1 18:26 /bin/login
Interpreting Permissions
-rwxr-x--- 1 andersen trusted 2948 Oct 11 14:07 myscript
In above screenshot student not able to create a file in /student dir. Because
/student dir is owned by user root group owned root and also other have
read and execution permissions there is no write permission. Therefore we
need to change the owner as a student for /student.
[root@server1 ~]# chgrp student /student
[root@server1 ~]#
[root@server1 ~]#
[root@server1 ~]#