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

Note

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.