Creating Users#
The command to add a user to your Ubuntu system is adduser. I don't need to go into details on how-to use this command because you can read the manpage now, right?
Let's look at some examples:
1 | |
Then we get this:
1 2 3 4 5 6 | |
Instead of providing most of the information along with our command line, we're prompted for the information needed by the command. I'm going to fill it out like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
For the password I just used badpassword because to be honest it doesn't matter inside of our VM.
We can also provide all the answers to these question on the command line too, except for the password:
Note
Use sudo deluser superman to delete the user before you try the below command, otherwise it won't work.
1 | |
And we get this:
1 2 3 4 5 6 7 8 | |
Now we have a user called superman on the system. We can login as that user now. Try it:
- Logout of your current user by typing
exit - At the login prompt login with
supermanandbadpassword(unless you picked a different password)
And just like you're the superman user.
That's the simple way of creating users. In an enterprise or business environment, user management could be centralised, and this isn't how you would add users. It depends and changes from environment to environment.
As the superman user, give this a try: sudo adduser spiderman. I get this:
1 2 3 | |
It failed because our first user, in my case michael, has been granted access to the sudo command and can run privileged commands. Our new user, superman, cannot. Let's fix that.