-
User ManagementDevOps/CommandLine 2020. 1. 13. 12:54
1. Overview
User management includes everything from creating a user to deleting a user on your system. User management can be done in three ways on a Linux system.
2. Description
2.1 Local user database
/etc/passwd
It has seven columns separated by a colon
demyank:x:1000:1000:demyank:/home/demyank:/bin/bash username, an x, user id, primary group id, a description, name of home directory and a login shell
2.2 Group database
/etc/group
2.3 root
The root user is the superuser and have all the powers for creating a user, deleting a user and can even login with the other user's account. The root user always has userid 0
2.3.1 Switch to root account
[demyank@localhost ~]$ su Password:
2.3.2 Adding a user to superuser
usermod -aG wheel demyank
2.3.3 Enable wheel group to use sudo
visudo: Edit /etc/sudoers
Uncomment below line
# %wheel ALL=(ALL) ALL
2.4 Managing User and Group
2.4.1 useradd
[demyank@localhost ~]$ adduser testuser
2.4.2 Switching to a specific user
[demyank@localhost ~]$ su - testuser [testuser@localhost ~]$
2.4.3 list groups
[testuser@localhost ~]$ groups testuser
2.4.4 usermod
[root@localhost ~]$ usermod -aG wheel testuser
2.4.5 userdel
[root@localhost ~]$ userdel testuser # By using userdel -r option, you can delete home directory along with user account. [root@localhost ~]$ userdel -r testuser
3. Reference
https://linuxhint.com/sudo_linux/
https://www.javatpoint.com/linux-user-management
https://www.rosehosting.com/blog/how-to-create-users-and-manage-their-sudo-privileges-on-ubuntu/
https://www.tecmint.com/fix-user-is-not-in-the-sudoers-file-the-incident-will-be-reported-ubuntu/
'DevOps > CommandLine' 카테고리의 다른 글
Permissions (0) 2020.01.13