Last updated on July 3, 2020 by Dan Nanni
When it comes to creating a new user account on Linux, there are two command-line tools you can use: useradd
and adduser
. What is the difference between these two with confusingly similar names?
First of all, useradd
is a simple Linux command that creates a user account in one shot. Using various command line options, you can specify the group that a new user belongs to (-g
), path to home directory (-d
), user's shell (-s
), initial password (-p
), as well as instruct the command to create user's home directory (-m
). To create a Linux account named nanni
:
$ sudo useradd -g nanni_group -d /home/nanni -s /bin/bash -p my_password -m nanni
The other utility called adduser
performs the same action, but this program is meant to be a more user-friendly version of useradd
described earlier. When invoked, adduser
asks you a series of questions regarding a new account being created, including user's first/last name and account password, and goes ahead creating a home directory of the account. See adduser
in action below.
However, the availability of adduser
varies among different Linux distributions. While Debian and Ubuntu systems have adduser
available by default, CentOS, RHEL and Fedora systems have adduser
simply as a symbolic link pointing to useradd
, so there is really no distinction between the two commands.
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean