User management (create user-specified password)
basic introduction
User home directory : The directory contains the home directory /home/
of each created user. When the user logs in, they will automatically enter their home directory.
Add user
useradd [选项] 用户名
[options], can be omitted
Example: useradd xm
An xm account was created because we did not specify the group of the xm account. Linux automatically creates an /home
xm , and xm belongs to the xm group.
note
When the user is successfully created, a home directory with the same name as the user will be automatically created
It is also possible
useradd -d 指定目录 新的用户名
to specify a home directory for the newly created user.Example:
useradd -d /home/dog xq
Set or change password for user
passwd 用户名
switch user
su 用户名