You are on page 1of 9

Chapter 5

User Account Management


User accounts
User Account Information
ery linux Installation typically contains three types
of user accounts:
The super-user (UID=0, GID=0)
The system-user (UID,GID=1 - - 499)

The regular-user (UID, GID=500 - - 65534)

By Msc. Khiev Sopheaktra Chapter 06: Module1-System and User Security 2


User Managing Commands
• #useradd –u<uid> -c<comment> User-name
• #useradd –m sok
• #system-config-users

• #userdel
• #userdel sok
• #userdel –r sok

• #passwd
• #passwd sok
• #passwd -d username (remove password)

• #chage -d 0 user (Force a user to change their password at next login)


• #chage –d 0 user1
• #chage –l user1 (view info)
• Setting Expire
• #chage –E 12/31/2019 –M 90 –I 30 –W 14 sok

• #chage –l sok

• #chage –E 12/30/2019 sok

• #chage –E -1 –M 99999 –I -1 sok (never expire)

• warning to WARN_DAYS
• #chage –W 5 sok

• #chage –l sok
User Managing Commands
• #usermod –L/-U username (-L : Disable; -U : Enable)
• #usermod –L sok

• #usermod –U sok

• Rename User
• #usermod –l [newname] [oldname]

• #usermod –m –d/home/[newname] –l [newname] [newname]


• #usermod –l sok theary

• #usermod –m –d/home/sok –l sok sok


Group Managing Commands
• #groupadd
• #groupadd G-Sale

• The -g option can be used to specify a group id:


• #groupadd -g 510 Sale

• #groupdel
• #groupdel G-Sale

• #usermod –g [groupname] [user-name]


• #usermod –g G-sale theary
Modifying a Group
• The groupmod –n <newgroup> <oldgroup> command changes a
group’s name.
• #groupmod –n Sales1 Sales

• The groupmod –g <newGID> <GroupName> command changes


a group’s ID.
• #groupmod –g 450 Sales1

8
File and Folder owner Commands

• #chown [user name] [file name/folder]

• #chgrp [group name] [file name/folder]

• #chown –R [user name]:[group name] [file name]

• #Chmod 755 /home/data.txt


• #chmod [ u g o a ] [ = + - ] [rwx] [file name]

• 755= [4+2+1] [4+1] [4+1]= [Read-Write-Exectute] [Read-Execute] [Read-Execute]

You might also like