You are on page 1of 7

Q1 Create few users

(student1,student2,student3,faculty1,faculty2,instructor1,instructor2)

Fig 1.1
Add user is the command user to add a user to your current machine ,We can only add user when
we are superuser or root user as given is Fig 1 .1
1)syntax: adduser user_name
Example :Fig 1.1
sudo adduser faculty3

Number of User login in current machine.

Fig 1.2
In Fig 1.2 it is showing number active user present in system .
To check number active user we can use who command.
Tree of Home Directory

Fig 1.3
In Fig 1.3 showing the Tree hierarchical .

Q2 Create Groups like mca-students,mca-faculties and Instructors

Fig 2.1
In this Fig 2.1 We are created group by using addgroup
Syntax: addgroup group_name
Example:Fig 2.1
addgroup mca-students
addgroup mca-faculties
addgroup instructors
Grouping the User to there particular Group

Fig 2.2
In Fig 2.2 We are adding user to there particular group using user mod command
syntax: usermod -a -G group_name user_id
Example: Fig 2.2
usermod -a G mca -students student1
usermod -a G mca-faculties faculty1

Members of the particluar group

Fig 2.3
In Fig 2.3 We can see the user present in that particular group this information is obtained by
command getent group
syntax: getent group group-name
Example:Fig 2.3
getent group mca-students
Q3) Creating few Files in student1,faculty1,mca-students,mca-
faculties and let the files types be regular.

Fig 3.1
In Fig 3.1 We create a file using touch command and content using vi commad and we view the
content of the file using cat command, This file is created by student1 user.

Fig 3.2
In Fig 3.2 We create a file using touch command and content using vi commad and we view the
content of the file using cat command, This file is created by faculty1 user.
Q4) Working with chown and chgrp

Fig 4.1
In Fig 4.1 We can see that the owner of file is changed from student1 to student2 by using chown
command is can be used the owner of the file, To change owner of a file we chown command in
supermode
syntax:
chown user_name file_name
Example: Fig 4.1
chown student2 student1.text

Changing group in a file.

Fig 4.2
In Fig 4.2 We can see that the group of file is changed from faculty1 to mca-students by using
chgrp command is can be used the group of the file, To change group of a file we chown command
in supermode
syntax:
chown user_name file_name
Example: Fig 4.1
chown student2 student1.text
Q6 Experimentent with chmod

chmod command is used to change the permission of file.

Fig 6.1
We can see in this we try execute the file without permission file was not executed but using
chmod command we give permission to the file for owner can execute the file after that file is
executed.

For group member to access the File

Fig 6.2
We can see in this we as a groupuser try access the file which belong to that group but file is not
extecuted because permission was not given the user, after the owner give the permission to the
group after that group user can execute the file .
Other User try acess the file

Fig 6.3
We can see in this we try as a other access the file which belong to that faculty1 but file is not
extecuted because permission was not given by the owner after the owner give the permission to
the other user after that other user can execute the file .

Read file Permission

Fig 6.4
In this we can see that user trying to access the file by removing the read permission but kernel has
denied access because user cannot read file .

You might also like