Pages

Wednesday, June 14, 2017

Difference between adduser and useradd in Ubuntu server

Difference between adduser and useradd in Ubuntu server


Difference between adduser and useradd in Ubuntu-server



Both the command are used to add user in the system. But there is a big difference.
Nowadays debian has changed or replaced the useradd command with adduser.


The difference between both command is as following with the image so that will make clear sense to you people.

To check the difference between both the command do the following.

1. useradd

Open the terminal and type

$ sudo useradd user2

The above command will add the user


 $ sudo passwd user2

The above command will give the password to the user2.



Now lets try loging in.

login: user2
password:123

As you can there is no home directory is defined.And not able to create its own directory with "useradd"  command.

 You can also check the directory and the command assigned to it



==========================================================================
2. adduser

Open the terminal and type :-

$ sudo adduser user3

The adduser command takes all the information and create your personal home directory for saving your data and gives uid and gid with that.



You can see the home directory assigned to user3 by this command.

$ cat /etc/passwd | grep user3




From this tutorial you can might have understand the difference between both the command and how you can add the other or extra user  in the system.


















No comments:

Post a Comment

Note: Only a member of this blog may post a comment.