SEARCH

How-To Geek

Create a New User on Ubuntu Server 9.10

Creating a new user on Ubuntu server is easy—just sudo your shell to root, or run the following command:

adduser username

This will create the user, with output something like this:

root@ubuntugeek910:~# adduser testuser
Adding user `testuser' ...
Adding new group `testuser' (1001) ...
Adding new user `testuser' (1001) with group `testuser' ...
Creating home directory `/home/testuser' ...
Copying files from `/etc/skel' ...

You can see all the options by typing adduser --help at the prompt.

adduser [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID]
[--firstuid ID] [--lastuid ID] [--gecos GECOS] [--ingroup GROUP | --gid ID]
[--disabled-password] [--disabled-login] [--encrypt-home] 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[_SYSTEM] configuration variable
  --help | -h       usage message
  --version | -v    version number and copyright
  --conf | -c FILE  use FILE as configuration file

So there you have it. Creating a new user is easy.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 11/30/09

Comments (2)

  1. Eugene

    If I would specify a home directory for a new user same as directory of existing user, will it clean it contents or just make a link to the existing one?

  2. Internet Person

    @Eugene:
    One option might be to test this on a COPY of the home directory and see what happens?

    Copies can be made easily with variations of the ‘cp -a ‘ type command or ‘rsync -avP ‘ or simply using the graphical file manager of your choice if you have proper access privileges to all the files in question for a drag-n-drop operation.

    If you target the copy first then you still have the unaltered original to fall back on if you make a mess. ;)

Enter Your Email Here to Get Access for Free:

Go check your email!