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
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
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
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/
This command will add the new user with /home/manav as the default directory.
5. 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
This command will display the help section of the adduser command.