User and Groups
Administrator
1
Linux
 Linux is a multi-user operating system, which
means that more than one user can use Linux at
the same time. Linux provides a beautiful
mechanism to manage users in a system. One of
the most important roles of a system
administrator is to manage the users and groups
in a system.
2
Linux user
 A user or account of a system is uniquely identified by a
numerical number called the UID (unique identification
number). There are two types of users – the root or super
user and normal users. A root or super user can access all
the files, while the normal user has limited access to files.
A super user can add, delete and modify a user account.
The full account information is stored in
the /etc/passwd file and a hash password is stored in the
file /etc/shadow
3
Creating a user with a default setting:
 A user can be added by running
the useradd command at the command
prompt. After creating the user, set a
password using the
passwd utility, as follows:
4
[root@localhost bhargab]# useradd anirban
[root@localhost bhargab]# passwd anirban
Changing password for user anirban
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
5
The system automatically assigns a UID, creates
the home directory (/home/<username>) and sets
the default shell to /bin/bash.
The useradd command creates a user private
group whenever a new user is added to the
system and names the group after the user.
Specifying a user’s full name when creating a
user: A systems administrator can use the –c
option with useradd to specify the user’s full
name, as shown below:
[root@localhost bhargab]# useradd -c “Anirban Choudhury” anirban
6
Creating a user with non-default home
directory
[root@localhost bhargab]# useradd –d /home/test
anirban
A non-default home directory can be set by executing the
following command:
7
Adding a user to a primary group and
supplementary group
[root@localhost bhargab]# useradd -g “head” -G
“faculty” anirban
A systems administrator can specify a primary group and a supplementary one by
specifying the –g and –G option, respectively.
8
Locking and unlocking a user
[root@localhost bhargab]# passwd -l anirban
Locking password for user anirban.
passwd: Success
[root@localhost bhargab]# passwd -u anirban
Unlocking password for user anirban.
passwd: Success
A super user can lock and unlock a user account. To lock an account,
one needs to invoke passwd with the -l option.
The –u option with passwd unlock an account, as
shown below:
9
Changing a user name
[root@localhost bhargab]# usermod -l “nishant”
anirban
The –l option with the usermod command changes the login (user) name,
as shown below:
10
Removing a user
[root@localhost bhargab]# userdel -r nishant
Combining userdel with the –r option drop a user and the
home directory associated with that user, as shown below:
11
Linux group
 Linux group is a mechanism to organise a collection of
users. Like the user ID, each group is also associated with
a unique ID called the GID (group ID). There are two types
of groups – a primary group and a supplementary group.
Each user is a member of a primary group and of zero or
‘more than zero’ supplementary groups. The group
information is stored in /etc/group and the respective
passwords are stored in the /etc/gshadow file. Some
operations such as creating, deleting and modifying on a
group are discussed below.
12
Creating a group with default settings
[root@localhost bhargab]# groupadd employee
[root@localhost bhargab]# gpasswd employee
Changing the password for group employee
New Password:
Re-enter new password:
To add a new group with default settings, run the groupadd command as a root user,
as shown below:
If you wish to add a password, then type gpasswd with the group name, as follow:
13
Creating a group with a specified GID
[root@localhost bhargab]# groupadd -g 1200 manager
To explicitly specify the GID of a group, execute the groupadd command
with the –g option, as follow:
14
Removing group password
[root@localhost bhargab]# gpasswd -r employee
To remove a group password, run gpasswd –r with the relevant group name,
as follow:
15
Changing the group’s name
[root@localhost bhargab]# groupmod -n hrmanager
employee
To change the group’s name, run the groupmod command with
the -n option as a super user, as shown below:
16
Changing the group’s GID
[root@localhost bhargab]# groupmod -g 1050 manager
To change the GID of a group, run the groupmod command
with –g, as follow:
17
Deleting a group
[root@localhost bhargab]# groupdel employee
Before deleting a primary group, delete the users of that primary group.
To delete a group, run the groupdel command with the group name,
as shown below:
18
Access Control List(ACLs)
Red Hat Enterprise Linux supports access control
lists (ACLs) for files and directories which allow
permissions for specific users outside of the owner to be
set.
19
User management
To list users currently logged on the
system, the who command can be used.
To list all existing user accounts including their properties stored
in the user database.
20
User and Group management tools
 Managing users and groups can be a tedious
task, but Red Hat Enterprise Linux provides
tools and conventions to make their
management easier.
 The easiest way to manage users and
groups is through the graphical
application, User Manager
21
What are User and Group Permissions?
 Linux/Unix operating systems have the ability to
multitask in a manner similar to other operating
systems. However, Linux’s major difference from
other operating systems is its ability to have multiple
users. Linux was designed to allow more than one
user to have access to the system at the same time.
In order for this multiuser design to work properly,
there needs to be a method to protect users from
each other. This is where permissions come in to play.
22
Working with Users, Groups, and Directories
 The following sections will go over the commands
needed to create, delete, and modify user
accounts. Groups will be covered, as well as
commands for creating and deleting directories.
You will be provided with the commands and
descriptions needed for working with users,
groups, and directories.
23
THANKS
TO ALL OF YOU
24

User and groups administrator

  • 1.
  • 2.
    Linux  Linux isa multi-user operating system, which means that more than one user can use Linux at the same time. Linux provides a beautiful mechanism to manage users in a system. One of the most important roles of a system administrator is to manage the users and groups in a system. 2
  • 3.
    Linux user  Auser or account of a system is uniquely identified by a numerical number called the UID (unique identification number). There are two types of users – the root or super user and normal users. A root or super user can access all the files, while the normal user has limited access to files. A super user can add, delete and modify a user account. The full account information is stored in the /etc/passwd file and a hash password is stored in the file /etc/shadow 3
  • 4.
    Creating a userwith a default setting:  A user can be added by running the useradd command at the command prompt. After creating the user, set a password using the passwd utility, as follows: 4
  • 5.
    [root@localhost bhargab]# useraddanirban [root@localhost bhargab]# passwd anirban Changing password for user anirban New password: Retype new password: passwd: all authentication tokens updated successfully. 5
  • 6.
    The system automaticallyassigns a UID, creates the home directory (/home/<username>) and sets the default shell to /bin/bash. The useradd command creates a user private group whenever a new user is added to the system and names the group after the user. Specifying a user’s full name when creating a user: A systems administrator can use the –c option with useradd to specify the user’s full name, as shown below: [root@localhost bhargab]# useradd -c “Anirban Choudhury” anirban 6
  • 7.
    Creating a userwith non-default home directory [root@localhost bhargab]# useradd –d /home/test anirban A non-default home directory can be set by executing the following command: 7
  • 8.
    Adding a userto a primary group and supplementary group [root@localhost bhargab]# useradd -g “head” -G “faculty” anirban A systems administrator can specify a primary group and a supplementary one by specifying the –g and –G option, respectively. 8
  • 9.
    Locking and unlockinga user [root@localhost bhargab]# passwd -l anirban Locking password for user anirban. passwd: Success [root@localhost bhargab]# passwd -u anirban Unlocking password for user anirban. passwd: Success A super user can lock and unlock a user account. To lock an account, one needs to invoke passwd with the -l option. The –u option with passwd unlock an account, as shown below: 9
  • 10.
    Changing a username [root@localhost bhargab]# usermod -l “nishant” anirban The –l option with the usermod command changes the login (user) name, as shown below: 10
  • 11.
    Removing a user [root@localhostbhargab]# userdel -r nishant Combining userdel with the –r option drop a user and the home directory associated with that user, as shown below: 11
  • 12.
    Linux group  Linuxgroup is a mechanism to organise a collection of users. Like the user ID, each group is also associated with a unique ID called the GID (group ID). There are two types of groups – a primary group and a supplementary group. Each user is a member of a primary group and of zero or ‘more than zero’ supplementary groups. The group information is stored in /etc/group and the respective passwords are stored in the /etc/gshadow file. Some operations such as creating, deleting and modifying on a group are discussed below. 12
  • 13.
    Creating a groupwith default settings [root@localhost bhargab]# groupadd employee [root@localhost bhargab]# gpasswd employee Changing the password for group employee New Password: Re-enter new password: To add a new group with default settings, run the groupadd command as a root user, as shown below: If you wish to add a password, then type gpasswd with the group name, as follow: 13
  • 14.
    Creating a groupwith a specified GID [root@localhost bhargab]# groupadd -g 1200 manager To explicitly specify the GID of a group, execute the groupadd command with the –g option, as follow: 14
  • 15.
    Removing group password [root@localhostbhargab]# gpasswd -r employee To remove a group password, run gpasswd –r with the relevant group name, as follow: 15
  • 16.
    Changing the group’sname [root@localhost bhargab]# groupmod -n hrmanager employee To change the group’s name, run the groupmod command with the -n option as a super user, as shown below: 16
  • 17.
    Changing the group’sGID [root@localhost bhargab]# groupmod -g 1050 manager To change the GID of a group, run the groupmod command with –g, as follow: 17
  • 18.
    Deleting a group [root@localhostbhargab]# groupdel employee Before deleting a primary group, delete the users of that primary group. To delete a group, run the groupdel command with the group name, as shown below: 18
  • 19.
    Access Control List(ACLs) RedHat Enterprise Linux supports access control lists (ACLs) for files and directories which allow permissions for specific users outside of the owner to be set. 19
  • 20.
    User management To listusers currently logged on the system, the who command can be used. To list all existing user accounts including their properties stored in the user database. 20
  • 21.
    User and Groupmanagement tools  Managing users and groups can be a tedious task, but Red Hat Enterprise Linux provides tools and conventions to make their management easier.  The easiest way to manage users and groups is through the graphical application, User Manager 21
  • 22.
    What are Userand Group Permissions?  Linux/Unix operating systems have the ability to multitask in a manner similar to other operating systems. However, Linux’s major difference from other operating systems is its ability to have multiple users. Linux was designed to allow more than one user to have access to the system at the same time. In order for this multiuser design to work properly, there needs to be a method to protect users from each other. This is where permissions come in to play. 22
  • 23.
    Working with Users,Groups, and Directories  The following sections will go over the commands needed to create, delete, and modify user accounts. Groups will be covered, as well as commands for creating and deleting directories. You will be provided with the commands and descriptions needed for working with users, groups, and directories. 23
  • 24.