This knowledge point, blurred for a long time.
In production, the habit is as follows:
Useradd, the default is to add a new user to the user group with the same name. For example, Useradd zhouls, after this command is executed, is added to the Zhouls user group with the same name by default.
However, in production, generally do not do so. Usually,useradd-m-G . Otherwise, when it appears, the user is established, but the home directory does not appear oh. Careful!!! (important words, say three times)
################### #CentOS系统里 ##########################
In the CentOS system, the root user executes the
First step:groupadd new user group
Groupadd Hadoop This is the creation of a Hadoop user group
Step Two:useradd-m-G created user group New user
Useradd-m-G Hadoop Hadoop This is a new Hadoop user and home directory also created and added to the Hadoop group
Step three:passwd has created a user
passwd Hadoop Hadoop User Password
Changing password for user Hadoop
New Password:
Retype new Password:
###################################
################## #Ubuntu系统里 ###########################
Ubuntu system, root user execution, first how to open, see Ubuntu14.04 after installation of some configuration
First step:sudo groupadd new user group
sudo groupadd Spark This is the Create Spark user group
Step two:sudo useradd-m-G created user group New user
sudo useradd-m-G spark Spark This is a new spark user and home directory also created and added to the Spark group
Step three:sudo passwd user created
passwd Spark Spark User password
Changing password for user spark
New Password:
Retype new Password:
###################################
deleted, here, not much to repeat. corresponding to, for Userdel, can.
Modified, here, also not much to repeat. corresponding to, for Usermod, can.
New user group, user, user password, delete user group, user (for CentOS, Ubuntu)