Você está na página 1de 51

USER ADMINISTRATION

In this session we are going to see:

• how to add a new user.


• how to modify the user information.
• how to assign the password for the user.
• how to modify the password aging information.
• how to add a new group.
• how to add the user in the group.
USER ADMINISTRATION
 Adding a new user:

Syntax:
useradd [options] username
Example:
useradd tom
Running useradd command is like editing the
the following files:
/etc/passwd
USER ADMINISTRATION
/etc/passwd:
Passwd file used to store user information.
 In this file following information stored.
 username
 password indicating (X)
 UID (user ID)
 GID (group ID)
 Comment line
 home directory
 shell
Example:
root:x:0:0:root:/root:/bin/bash
USER ADMINISTRATION
Usermod:
It is used to modify the user account
information.
Syntax:
usermod <-options> username
Options:
-u uid -d directory
-g gid -s shell
-c comments
Example:
usermod –u 1000 –g 1000 tom
USER ADMINISTRATION
 User Del:
It is used to delete the user account

Syntax:
userdel <-options> <username>

Options:
-f Force
-r Remove
Example:
userdel –r tom
USER ADMINISTRATION
Set a password for user
Passwd information can be saved in /etc/shadow file

Syntax:
passwd <-options> [username]

Options:
-d delete
-l lock
-u unlock
Example:
passwd tom
USER ADMINISTRATION
/etc/shadow:
Shadow file used to password aging information
for each users. It contains following this,
root : $1$.QKjRxrXYgc98F. : 12825 : 0 : 99999 : 7 : : :
 username
 encrypted password
 last change password
 minimum no. of day to change password
 maximum no. of day to change password
 warning days change to password
 password inactive date
 account expiry date
USER ADMINISTRATION
/etc/group:
It shows group information for each users.
Example:
root:x:tom

 group name
 encrypted password
 group members
USER ADMINISTRATION
 Adding a new group:
This command used to add a new group to
Linux.
Syntax:
groupadd <groupname>
Example:
groupadd data
USER ADMINISTRATION

 Removing the group:


This command used to delete a group
Syntax:
groupdel <groupname>
Example:
groupdel data
delete the group by this command
USER ADMINISTRATION

Groupmod:
It is used to rename a group
Syntax:
groupmod <-options> < newname>
Options:
-n rename
-g group ID
Example:
groupmod –g 2000 data
USER ADMINISTRATION
UID:
UID 0 – reserved for the user ‘root’

 Normal users start from UID 1000.


 Root user is called super user.
 Root users has unlimited access to all the files,
devices, and programs on the system.
 Root user has a complete control over the
system.
USER ADMINISTRATION
GID:

Group ID 0 reserved for root group.


Group ID range 1-99 user service and
program groups.
Group ID 1000 for normal users group.
Managing User Accounts

To view a user
associated with file
or directory
Managing User Accounts

File which stores


the user account
information
Managing User Accounts

Content of the
/etc/passwd file
Managing User Accounts

To add new
user account

To view the home


directory of local
user
To remove a
local user
Managing User Accounts

To set the
password aging
information for a
local user
Managing User Accounts

To set password
update for the next
login
Managing User Accounts

To view the
password aging
information of a
user
Managing User Accounts

To lock an
user account
USER ADMINISTRATION

Adding the user anu


USER ADMINISTRATION

Adding user manu


USER ADMINISTRATION
The user’s are created successfully, and
their information are store in
/etc/passwd file

Login Shell.

The first fields


User home
username
User id directory.

Group id Comment.
The second field refers
the password.
USER ADMINISTRATION

View the UID of


user anu
USER ADMINISTRATION

By changing UID
for user anu
USER ADMINISTRATION

UID has been


changed
USER ADMINISTRATION

To add a comments for


user anu
USER ADMINISTRATION

Comments has
been changed
USER ADMINISTRATION

Create the new


directory in / directory
USER ADMINISTRATION

-d option to change the


home directory in -m option to move user
/etc/passwd file home directory from /home
to /advpro/anu
USER ADMINISTRATION

User home
directory changed
USER ADMINISTRATION

Login as user anu & check


user home directory
USER ADMINISTRATION

By using this command


to change this shell
USER ADMINISTRATION

Login Shell has


been changed
USER ADMINISTRATION

Assigning the password


for user anu
USER ADMINISTRATION

The password information


is stored in the shadow file

Username

Encrypted Last password


password. change number
Minimum date. of Maximum number of days to
days to change the change the password
Warning days
Account expired password
date. Password
inactive date
USER ADMINISTRATION

List the password aging


information in human
readable format
USER ADMINISTRATION

To set the minimum number


of days to change password
for user anu
USER ADMINISTRATION

The minimum number of days has


been changed for the user anu
USER ADMINISTRATION

Login as the user anu

To change the password,


and it shows the error
message
USER ADMINISTRATION

To set the maximum


number of days to change
password for user anu
USER ADMINISTRATION

The maximum number of days


has been changed for user anu
USER ADMINISTRATION

To change the
warning days
USER ADMINISTRATION

Create 3 Users(sym1,2,3) and one group (sym)


USER ADMINISTRATION

Add sym1 and sym2 users to sym group


USER ADMINISTRATION

Create a folder(sym) in / location set permissions only sym group users


USER ADMINISTRATION

/sym Directory access only for sym group


USER ADMINISTRATION

Change ownership

Você também pode gostar