User Groups and Permissions
– Users
Types: UID
1. Root user 0
2. System users 1-499
3. normal users >500
/etc/passwd – User database
format
Username:x:UID:GID:<comment>:home_dir:shell
X=Encricpted password
(/etc/shadow)
Groups
Types: GID
1. Root users group 0
2. System User group 1-499
3. Normal user group >500
/etc/group database file
Format
Groupname:x.GID:<members_of_the_group>
X=encripted password
(/etc/gshadow)
User Information commands
# whoami (displays login name)
#who
#users
#w
above three commands displays list of currently logged in users
#groups
#id
above two commands displays the list of groups of which the logged in user is
a member
Unit 5 Uses, Groups & Permission (contd…)
* Switching users account
# su – username
eg. # su – sbogati (It asks password for loging user)
* User Categories
Owner -u
Group -g
others-o
all(ugo)-a
Permission types:
Permissions Symbolic represatation Numeric value(octual value)
Read r 4
Write w 2
Execute x 1
No Permission – 0
Permission operators
Options Meaning
——- ———
+ to add permission
[on existing one]
– to remove pewrmission
(from existing one)
= to absolutly assign permission
(overwriting existing one)
* Effects of permission:
Permission Effects on a file Efects on a dir
1. Read (r) 1. It allows to view the 1. It allows to list the content s of a dir
[ls]
2. Write (w) 2. It allows to modify the 2. It allows to create/remove/re name files/dirs. inside the
directory
[cat>, mkdir, mv, rm etc.]
3. Execute (x) 3. It allows to execute the file
if it is a program file. 3. It allows to enter into the
dir
[cd]
contents of a file
[vi nano,..]
contents of a file
[cat, vi, less
* Umask
——–
It is a value that determines default permission (ig. permission at the time of
file/dir. creation) on a file or dir.
———-
1. – type
2. d dir
3. l symbolic link
4. b block device file
5. c character device file
Above 9 tpye are called permission string
first 3 are owners permission, sedond 3 are group permission and last 3 are others permissions