FactorPad
Build a Better Process

Linux adduser Command Summary with Examples

Linux adduser allows you to add users and groups.
  1. Purpose - Learn what adduser is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with adduser.
  4. A tip - Finish off with one more insight.
face pic by Paul Alan Davis, CFA
Updated: February 24, 2021
In this tutorial on Linux adduser, 81 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / adduser-command.html


An ad-free and cookie-free website.


Examples of the Linux adduser Command

Beginner

Learn to add users at the Linux command line.

Video Tutorial

Videos can also be accessed from the Linux Essentials Playlist on YouTube.

Linux adduser Command Summary with Examples (3:26)

Video Script

The Command and Why You Need It

Our eighty-first word, or command to memorize is adduser from our category Users.

adduser allows you to add users and groups.

Common Linux adduser Options
-options description
-h, --help Print help screen
--system Set up system users
--group Add new group

Recall from recent videos (tutorials) on we're learning superuser administrative tasks and functions, and now we'll tacking on adding new users.

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The adduser command has 20 options, and the argument is the user or group to add or maintain in some way. Please note, there is a similar tool called useradd used on some distributions.

Like most commands, help is available with double-dash --help. New system users can be added with the --system option. Groups are managed with the --group with sudo out front of course.

So why is adduser an important command? Well, system admins should plan for user growth. And now you know how to do that.

Demonstration

Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go. I don't typically jump right in to documentation in this section, taking time away from exercises, but this one is designed very well and lays out the five capabilities of adduser (Found using adduser --help).

$ adduser --help adduser [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--firstuid ID] [--lastuid ID] [--gecos GECOS] [--ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] USER Add a normal user adduser --system [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--gecos GECOS] [--group | --ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] USER Add a system user adduser --group [--gid ID] GROUP addgroup [--gid ID] GROUP Add a user group addgroup --system [--gid ID] GROUP Add a system group adduser USER GROUP Add an existing user to an existing group general options: --quiet | -q don't give process information to stdout --force-badname allow usernames which do not match the NAME_REGEX configuration variable --help | -h usage message --version | -v version number and copyright --conf | -c FILE use FILE as configuration file $ clear

First add normal user, then and a system user, add a user group, add a system group and add users to groups. Very descriptive.

And because that's a lot, we'll just tackle a couple, first sudo adduser yulie and watch.

$ sudo adduser yulie Adding user 'yulie' ... Adding new group 'yulie' (1001) ... Adding new user 'yulie' (1001) with group 'yulie' ... The home directory '/home/yulie' already exists. Not copying from '/etc/skel'. Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for yulie Enter the new value, or press ENTER for the default Full Name []: Yulie Room Number []: Work Phone []: Home Phone []: Other []: Is this information correct? [Y,n] y $ _

A template or skeleton of files is copied to the new user's directory, and I need to fill in a few fields that go into a file of course.

And the directory contents we'll review with an ls -a in that new directory.

$ ls -a /home/yulie . .. .bash_logout .bashrc .profile

And last, add Yulie to the users group.

$ sudo adduser yulie users Adding user 'yulie' to group 'users' ... Adding user yulie to group users Done.

And last, verify by asking for her ID.

$ id yulie uid=1001(yulie) gid=1001(yulie) groups=1001(yulie),100(users)

Very good.

A Final Tip

Okay now you know how to use adduser. And you know the syntax for commands, options and arguments.

One last tip about the adduser command. So explore user admin programs available on your system. That other option useradd has a lot of the same functionality.

Okay, thanks for visiting today. I hope this was a helpful introduction to the adduser command.


Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:


What's Next?

We like to have a little fun on our YouTube Channel, subscribe and join to be part of it.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / adduser-command.html


linux adduser command
linux add user
linux useradd
useradd linux
add user linux
linux create user
debian add user
linux adduser examples
linux create new user
add user debian
linux add user to group
add user to group
linux user management
add group linux

A newly-updated free resource. Connect and refer a friend today.