To create new users in Linux is used the command “useradd”. The basic command is like this:
sudo useradd usernamenedded
if you want create some user which will have home directory and can log in use this command:
sudo useradd jack
but if you want to create user without home directory and who can’t log in execute this command:
sudo useradd –m jack
it is important too to create password for each user. To set new password run this command:
sudo passwd jack
the system will ask you the new password then you need rewrite it and press “enter” to set password. But if you want to create new user and set for them new password in one stem you are allowed use this command:
sudo useradd –m jack –p userPassword
where “userPassword” is the password for user.
To create new groups you should use the command “groupadd”. Let’s create some group with name “newgroup” and add there the new user which we have created by name “jack”.
sudo groupadd newgroup
now we can add the new user into this group. To do this you need to use the command “usermod” like this:
sudo usermod –a –G newgroup jack
INFO: “-a” is using for tell “usermod” that we are appending the name, and “-G” tell “usermod” that we append the name to the group.
To know what members have our group you can run this command:
grep newgroup /etc/group
that is all!!!