What is the use of option -o for command useradd? What is a good use case of this option?

2 Answers 2


useradd’s -o option, along with its -u option, allows you to create a user with a non-unique user id. One use case for that is to create users with identical privileges (since they share the same user id) but different passwords, and if appropriate, home directories and shells. This can be useful for service accounts (although typically you’d achieve the same result using sudo nowadays); it can also be useful for rescue purposes with a root-equivalent account using a statically-linked shell such as sash.


The -o option allows the creation of users with non-unique IDs, only when you also supply the numerical value of their UID with the -u option in the same line, e.g.:

# useradd -o huey -u 501
# useradd -o dewey -u 501
# useradd -o louie -u 501

This permits setting up multiple users with same rights and priveleges, but with different home directories and passwords.

  • # useradd -o scrooge -u 0
    – rrauenza
    Apr 9, 2019 at 21:44
  • 1
    Wonderful way to break all applications that parse usernames as output of id or ls -l. Given su - scrooge -c 'id -u -n' says 'root' :)
    – kubanczyk
    Apr 10, 2019 at 7:30
  • And, quite unexpectedly, it also totalled my gdm on Ubuntu 18.04. Awww crap, I should have done it inside container...
    – kubanczyk
    Apr 11, 2019 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .