Practical No.
Aim: Working with Users,Group and permissions.
1) useraddcommand to create a new user
2) Create a user account to grant him the privilege of super user, as shown below:
3) Open the file /etc/sudoers and the following lines for smith:
Jagdish ALL = (ALL) ALL It is as shown below:
4) Run the command visudo:
#visudo
(5) Test the configuration by making smith to login and perform any administrative activity as shown
below:
(i) Add user Mayuresh using sudo:
(ii) Changing password of Mayuresh using sudo:
(B) Temporarily changing identity with the help of su command:
(1) When root changes identity temporarily, with the help of su command, the system never asks for
password:
(2) But when any local user tries to change the identity temporarily, redhatsystem asks for the password
as shown below:
(C) Administrative Commands:
(1) useradd command with its options:
The file / etc/passwd also shows the entry of the user asfollow:
2) chagecommand to change the age of user’s password :
The above command also affects the file /etc/shadow asfollows:
3) passwdcommand to lock or unlock user’s password:
4) chshcommand to change the shell of user:
5) Groupaddcommand to create a new group and gpasswd command to add members and
administrator in the group:
The above command also affect the file /etc/group asshown:
D) File Permission
1) Using symbolic mode
i)u- owner
ii)g-group
iii)o-others
Permission types
i)r-read
ii)w-write
iii)x-execute
Here you can see the directory test has the permission for ownerrwx ,for group owner has the
permission rx and for others rx.
1) To add permission
‘+’ operator is used to add a permission on file as follows:
1) # Chmodg+wcommand is used to add write permission group owner
2) To remove permission
‘-’ operator is used to remove permission of files.
#Chmod u-x command will remove the execute permission of owner of test directory
3) To replace permission
‘=’ operator is used to replace the permission by old permission.
# Chmod o=rwcommand will replace the permission of others users byrwof abc.txt file.
2) binary reference and numeric mode
i)Read-4
ii)Write-2
iii) Execute-1
7=4+2+1 read+write+execute
5=4+1 read+execute
0 No permission
Chmod 750 command is used to give permission to owner as read,write and execute for group
owner as read and execute and for others no permission .
Chmod 754 command is used to give permission to owner as read,write and execute for group
owner as read and execute and for others read permission .
7=4+2+1 read+write+execute
5=4+1 read+execute
4 read