In this blog we will learn how to use useradd command create users in Linux . To create a user we can use a command called useradd and with this command we use some flags and the user name to create a user .First of all lets open our terminal , We can press ctrl+alt+ t to do this .
1.You just need to type command which is useradd and then the name of the user . Command : $useradd user_name
.
Then the flag which you canuse is – m flag and what this flag is going to do is it’s going to create a default home directory for this user.Command : $useradd username -m
2.Now the next command is – s command and this is the command for the default shell so this – s command is used for allowing the user to use the shell.
3.The next flag is – g and this is the default user flag and after this flag whatever user you type the user will be assigned that group .
There is also some more flags for example -c for providing the comments you can provide any comments after this for the user .
4.We need to create user with our root access so you just need to write sudo in front of the command inorder to create the user .
We haven’t provided any password so password can be given to the user with the command called the $passwd
.When you give this command as it is then it it will allow you to change the password for the root user but when you use this command with the argument for example mark then this will allow to change the password of mark and then you also need to use sudo command .
So this is about useradd command .
Leave a Reply