Categories

adduser vs useradd: Ubuntu, Debian, Gentoo, Fedora, CentOS

Written by Guillermo Garron .
Date: 2009-01-15 10:36:30 -0400

Updated: 2012-11-29

You may have been using useradd or adduser to add new users or create new accounts in your Linux powered PC.

And sometimes you may have wonder about the difference between the two of them, well, the difference is also different depending on what version you are using.

Debian / Ubuntu

On Debian or Ubuntu systems, useradd is a command itself, and you can create users and define options to them using this command, and adduser is a perl script, that uses useradd to create the account, asking you the password, Full-name, phone and others like this:

ggarron@debian:~/tmp$ sudo adduser test
Adding user `test' ...
Adding new group `test' (1004) ...
Adding new user `test' (1003) with group `test' ...
Creating home directory `/home/test' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for test
Enter the new value, or press ENTER for the default
Full Name []: gasf
Room Number []: asdg
Work Phone []: asdf
Home Phone []: asdf
Other []: asdf
Is the information correct? [Y/n] y

As you can see the script will do the job for you, I prefer using the command itself, as I like to have the control, but is up to you which one to use.

For your information, here is the Debian “Lenny” adduser script

Fedora / Centos

On Fedora or CentOS systems, adduser is just a symbolic link to useradd, but may try to copy the script from a Debian system to the CentOS one, I have never tried it, and may need to modify it a little before using it.

Gentoo

On Gentoo systems, is the same as in CentOS or Fedora, adduser is just a symbolic link to useradd.

I have read that on other distributions adduser is also a script maybe a bash script, but I do not have access to them now, if you are using Mandriva, OpenSuse or some other let us know how is in your systems

Conclusion

As you can see, both command does the same thing, just in different ways, one easier than the other. You can choose which one to use, and of course there are always graphic tools, specially now in Ubuntu.

permalink

If you enjoyed the article, please share it

twitter | facebook | google+ | linkedin | email | reddit