Open In App

adduser command in Linux with Examples

Last Updated : 22 Jun, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads