Creating and removing users

Creating users in Ubuntu can be done with one of either of two commands: adduser and useradd. This can be a little confusing at first, because both of these commands do the same thing (in different ways) and are named very similarly. I'll go over the useradd command first and then I'll explain how adduser differs. You may even prefer the latter, but we'll get to that in a moment.

First, here's an example of the useradd command in action:

# useradd -d /home/jdoe -m jdoe


As I mentioned in the front matter for this book, whenever I prefix commands with a pound symbol (#), I'm instructing you to execute the command as root. You can use the actual root account for these types of commands or you can simply prefix the command ...

Get Mastering Ubuntu Server now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.