adduser command in Linux with Examples

adduser command in Linux is used to add a new user to your current Linux machine. This command allows you to modify the configurations of the user which is to be created. It is similar to the useradd command in Linux. The adduser command is much interactive as compared to useradd command.

Installing adduser command

To install adduser tool use the following commands as per your Linux distribution.

In case of Debian/Ubuntu

$sudo apt-get install adduser

In case of CentOS/RedHat

$sudo yum install adduser

In case of Fedora OS



$sudo dnf install adduser

Working with adduser command

1. To add a new user

adduser username

To-add-a-new-user

This command will add a new user to your Linux system. It will ask for some details and after entering those details a new user account would be created.

2. To add a user with a different shell.

sudo adduser username --shell /bin/sh

To-add-a-user-with-a-different-shell

This command will change the default shell for the new user to /bin/sh.

3. To add a new user with a different configuration file.

adduser username --conf custom_config.conf

To-add-a-new-user-with-a-different-configuration-file



This command will take the configurations from the custom_config file and will create the new as per custom_config filename configurations.

4. To add a user with different home directory.

adduser username --home /home/manav/

To-add-a-user-with-different-home-directory

This command will add the new user with /home/manav as the default directory.

5. To get the version of the adduser command.

adduser --version

To-get-the-version-of-the-adduser-command

This command will print the version details of the adduser command.

6. To display the help section of the adduser command

adduser -h

To-display-the-help-section-of-the-adduser-command

This command will display the help section of the adduser command.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.