-
How To Add and Delete Users on a CentOS 7 Server
Adding Users
1 2
adduser username // add user passwd username // set or change a passwd
Granting Sudo Privileges to a User
1
gpasswd -a username wheel
-
Managing Users with Sudo Privileges
users in the wheel group
1
sudo lid -g wheel
Delete a User
1 2
userdel username userdel -r username
-
Check Disk Usage
1
df -h
-
Check Users
all users
1
sudo cat /etc/passwd
groups
1
groups
all groups a user belong to
1
groups freyzou
check a user’s info
1
id freyzou
users in a group
1
sudo grep 'freyzou' /etc/group
where-are-the-passwords-of-the-users-located-in-linux?
/etc/shadow
[Command to change the default home directory of a user closed]
1
2
3
4
# -d (abbreviation for --home) will change the user's home directory.
# -m (abbreviation for --move-home) will move the content from the user's current directory to the new directory.
usermod -d /newhome/username username
usermod -m -d /newhome/username username