Adduser Linux Commands – Overview with Examples and FAQs

Introduction

The Linux command adduser is a command line utility used to add a user to the system. It is used to create a new user account with a unique username and password. This command is used to create a new user account with the same privileges as the root user. It is also used to add a user to a specific group or to modify the existing user’s group membership. The adduser command is a part of the shadow-utils package and is available on most Linux distributions.

Examples

The adduser command is used to add a new user to the system. It is used to create a new user account with the specified username.

Syntax:
adduser [options] username

Options:
-c, –comment COMMENT: Set the GECOS field for the new user.
-d, –home HOME_DIR: Set the home directory for the new user.
-e, –expiredate EXPIRE_DATE: Set the account expiration date for the new user.
-f, –inactive INACTIVE: Set the number of days after a password expires until the account is permanently disabled.
-g, –gid GROUP: Set the primary group for the new user.
-G, –groups GROUPS: Set the supplementary groups for the new user.
-m, –create-home: Create the user’s home directory.
-M, –no-create-home: Do not create the user’s home directory.
-k, –skel SKEL_DIR: Use this alternative skeleton directory.
-K, –key KEY=VALUE: Override /etc/login.defs defaults.
-p, –password PASSWORD: Set the user’s password.
-r, –system: Create a system account.
-s, –shell SHELL: Set the user’s login shell.
-u, –uid UID: Set the user’s UID.
-U, –user-group: Create a group with the same name as the user.

Example:
To create a new user account with the username ‘john’ and the home directory ‘/home/john’, use the following command:

adduser -m -d /home/john john


Adduser Linux Command

The adduser command is a Linux command used to add a user to the system. It is a simple command that can be used to quickly add a user to the system without having to manually create the user’s home directory, copy files, and set permissions. The adduser command is part of the shadow-utils package, which is installed by default on most Linux distributions.

The adduser command takes a single argument, which is the username of the user to be added. The command will then prompt for the user’s full name, password, and other information. Once the information is entered, the user will be added to the system.

The adduser command can also be used to modify existing users. This can be done by using the -m option, which will modify the user’s information. The -d option can be used to change the user’s home directory, and the -s option can be used to change the user’s shell. The -g option can be used to change the user’s primary group, and the -G option can be used to add the user to additional groups.

The adduser command is a powerful tool for managing users on a Linux system. It can be used to quickly add new users, modify existing users, and manage user groups. It is an essential tool for system administrators.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
Jassweb, Rai Chak, Punjab, India. 143518