How to add a user to Ubuntu 12.04

12,577

You can add an new user (with the common options, and /home/[user] as home directory) with:

useradd -m -g users -s /bin/bash [user]

and then to set a password:

passwd [user]

EDIT: You can also add additional information about the user with:

chfn [user]
Share:
12,577

Related videos on Youtube

Sina
Author by

Sina

Updated on September 18, 2022

Comments

  • Sina
    Sina over 1 year

    This is very weird, when add a user using the command line then set a password I cant login using the GUI! is this a new thing or what?

    • Rinzwind
      Rinzwind almost 11 years
      Depends on the command used... 1 thing that is important: did you specify a /home?
    • Sina
      Sina almost 11 years
      No I didn't, I just used useradd with no options
  • Sina
    Sina almost 11 years
    does this mean that useradd <new user> does not work unless I use the -m -g switches?
  • Sina
    Sina almost 11 years
    This is exactly what I did, it didn't work
  • João André
    João André almost 11 years
    -m creates you home folder in /home/[user], and -g adds you to the groups users, which I am not sure if is set by default. If you just used useradd [user], then probably you would run into problems, as the GUI requires both.
  • ispasov
    ispasov almost 11 years
    Then try to change the password. Use comand: sudo passwd username