Difficult: easy
Avg Time: 1 min
Linux have a built in command called "useradd" that help people to add new user to the system.
To add a new user you must be logged as root or you will need to use sudo.
I will give some of the must useful examples.
Syntax: useradd options name
Example 1: Add new user to the system
useradd -r ricardoExample 2: Add new user and do not create home directory (/home)
useradd -rM ricardoExample 3: Add new user and create home directory in /home
useradd -rm ricardoExample 4: Add new user and specify the home directory
useradd -rd /somedir/somedir ricardoExample 5: Add a user and create a group with the same name
useradd -rn /somedir/somedir ricardoExample 6: Add a user and add user to existent group
useradd -r -g groupname ricardoExample 7: Add a user, create home directory and a group with same name
useradd -rmn ricardo
If you would like to set a password for the user i recommend you to use the passwd command instead of the -p option of useradd command.
Example 8: Create new user and set the password
useradd -rm ricardo
passwd ricardo
That's the way i use to add new user and set user password, if you have any other suggestion please post it as comment
Sem comentários:
Enviar um comentário