A system, we can not have only one user, so we need to create other users. This is especially true as a server Linux. In the enterprise, we should avoid directly using the root user directly.
First of all, we must first check the current user's username.
Use whoami: to view the current user's username.
Usage:
1, whoami directly enter, you can see the current user.
There are several ways to add users.
Method 1: Interactively set password
useradd [username]
password [username to set password]
Useradd has the following parameters:
-c<Remarks> plus comment text. The note text will be saved in the remarks field of passwd.
-d<Login Directory> Specifies the starting directory when the user logs in.
-D Change the default value.
-e<Validity Period> Specify the expiration date of the account.
-f<Buffer Days> Specifies how many days after the password expires, the account is closed.
-g<group> Specifies the group to which the user belongs.
-G<Group> Specifies the additional group to which the user belongs.
-m Automatically establish the user's login directory.
-M Do not automatically create a user's login directory.
-n Cancel the creation of a group named after the user name.
-r Create a system account.
-s<shell> Specifies the shell to use when the user logs in.
-u<uid> Specify a user ID.
Method 2: Set the user password in one step
useradd [username]
echo “[password to be set]”|
Passwd --stdin [username to set password]: Set password to oldboy via password.
useradd can be used to create a user account. After the account is built, use passwd to set the password for the account. Userdel can be deleted by userdel. The account created by the useradd command is actually saved in the /etc/passwd text file
userdel –r [username to be deleted]
The "[]” used in this article does not need to be written when actually writing the command.
If you have something wrong, you can tell me, let's study together.
Problem Description Review Linux file system management today, mount a new hard disk on a L
After reinstalling Win7, I have never tried to install Linux again, occasionally playing, an
A system, we can not have only one user, so we need to create other users. This is especially true a
Today, Xiaobian is a beginner Linux developer to explain how to install Linux. Here Xiaobian
Talk about the current and previous ways of doing SEO?
Samba and linux file permissions
The small knowledge points used in the Linux system accumulate
Linux Weblogic related environment variable setting
Happy experience of installing Ubantu under Windows
Ubuntu under the bower report EACCES: permissiondenied solution
Win10 system open task scheduler prompt "task object version is not supported or invalid" solution
WEB dedicated server security settings of the practical skills
Win7 system Computer boot screen black screen How to solve the host still running?
Win10 left navigation bar appears two U disk icons how to solve the solution
Mini Tips: Don't let the mouse wake up Windows 7 wake up
What is the function of Program files under Win7 system?
Teach you to easily and anti-virus Share the anti-drug elite under the command line
How to change the translucent window color in Windows 8