banner
破影岚歌

破影岚歌的博客

bilibili
twitter
github

14. Users and Groups in CentOS 7

Users and Groups in CentOS7#

root: Root User

Configuration Files for Users and Groups#

/etc/passwd: Users

Format:

username:password:UID:GID:user directory:shell program

/etc/group: Groups

About Groups in Linux:#

  1. Private Group: Created along with the user, named after the user
  2. Public Group: Custom created

About Users in Linux:#

  1. Root User: root has the highest authority
  2. Regular User: Can use the Linux system, but with limited permissions

Add User: useradd

Set User Password: passwd

About User Directory: By default, when adding a user, a directory with the same name as the user will be created in /home

Delete User: userdel username -r (delete user directory simultaneously)

Add Group: groupadd

Delete Group: groupdel

For example: Add users tom and mike; password 123; create a public group student; add tom and mike to the student group

usermod -G groupname username     # Move user to group
or
gpasswd -a username groupname     # Add user to group
gpasswd -d username groupname     # Remove user from group
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.