Now we’re going to create a new user. Type these commands:
useradd studenth
passwd studenth
You’ve just created a new user named studenth and a directory in /home/ called studenth.
useradd – Adding a new user
Options:
-d home directory
-s starting program (shell)
-p password
-g (primary group assigned to the users)
-G (Other groups the user belongs to)
-m (Create the user’s home directory)
To add a new user with:
- a primary group of users
- a second group mgmt
- starting shell /bin/bash
- password of xxxx
- home directory of roger
- a home directory, /home/roger
- a login name of roger:
useradd –g users –G mgmt -s/bin/shell -pxxxx -d/home/roger -m roger