Managing users in Ubuntu

A short, practical guide to user management in Ubuntu and GNU/Linux

Download the whole article as PDF

Short URL: http://fsmsh.com/1372

Write a full post in response to this!


As you notice from day to day use of Ubuntu, most tasks are easily accomplished. But what happens when you’re ready to expand your use of Ubuntu to include new applications, or connect to a home network and add new users? This brief guide shares the key steps necessary to create and manage other users, helps clarify some essential differences with other flavors, and provides tips regarding “root” user. Perhaps most importantly, these steps help empower the use of your Ubuntu system to become far more than just another desktop PC.

Understanding users in Ubuntu

The security and usefulness of your Ubuntu system depends a good deal on what you do to enable users and their privileges. Without falling into the minutia and the mundane, it is important to at least understand how users are handled in the Ubuntu GNU/Linux environment.

When you first install Ubuntu, you are required to create a user account. This initial user account, and for that matter all subsequent users, have their independent user files stored under the Home folder. But there is something unique about the first user account you create.

In my case, when installing Ubuntu, I created the user account: “mark”. Not only is mark my first Ubuntu user, but mark has automatically been given unique and powerful privileges that other users do not receive. My mark account can create users, change files and folders, and do a lot of administrative functions on Ubuntu that are normally performed by another important user account named “root”.

Therefore, in Ubuntu, you should understand the three key users:

  • Initial user, in my case called mark, created when installing Ubuntu
  • Root user, known as the administrator that usually has maximum privileges
  • All other users, which I term basic users, are added following installation

Each of these three key users have their own folders, their own unique privileges, and most importantly their own role to play on your Ubuntu system. In the following sections, I will share how to enable and utilize each. Let’s begin with the basic user.

NOTE: I assume that you are logged in to your Ubuntu system as the initial user, thereby having the rights and privileges necessary to perform the tasks below.

Creating and managing basic users

Inevitably, once you setup Ubuntu in your home or office, others will come to you begging to get access. Some may want a chance to try out one of the multitude of cool applications that come preloaded with your system, while others desire to see GNU/Linux power! In other words, you need a good way to give them access without giving them the keys to the system.

Step 1. Accessing the users and groups tool

Creating basic user accounts is easily accomplished through the Users and Groups tool. From your main menu, choose System, then Administration. To start your tool select the Users and Groups menu item.

Notice the message that appears (figure 1).

Figure 1: Using the privileged user account
Figure 1: Using the privileged user account

This is a very important message and what it infers is something unique about Ubuntu. In most GNU/Linux systems the privileged user is named root, and the password you type in would be that of root. However, in Ubuntu, the privileged user is the initial user account you created, and therefore you must type that user account password.

Once you type the password in, you will have access to all of the various administration tools. I provide more details regarding the reasons for this in the “Understanding the Superuser” section below.

Step 2. Adding a new user

You should now see the Users and Groups tool. Please choose the Add User button on the right.

What you choose to include in the Account sections should be based on who you’re adding, and what you plan to do with your Ubuntu system. If you’re adding a basic user so someone else can also access your Ubuntu system, the defaults will be satisfactory.

For an example, I will add my son John as a basic user of my Ubuntu system so he can enjoy some of those cool GNU/Linux games. Below is the sample user information. Notice that I chose to manually set the password, since I prefer to give him something that is both secure and easily remembered (figure 2).

Figure 2: Adding a new user with basic rights
Figure 2: Adding a new user with basic rights

Before you press the OK button, please click on the “User privileges” tab at the top. This is an important step whenever you create a new user.

Under the “User privileges” tab, note the default access given to this basic user. You may prefer to change some of these, such as “Monitor system logs”, “and Connect to Internet”. Anything that is checked is allowed by this user. Also make sure that the “Executing system administration tasks” is NOT checked.

Once you are satisfied with the privileges granted to this new user, press the OK button.

You should return to the main Users and Groups tool window. Now scroll down until you see the new user you just added. In my example, I added user: john (figure 3).

Figure 3: Successfully added new user
Figure 3: Successfully added new user

Once you are finished adding new basic users, it is very important to press the OK button again.

This will create the account and save the information you added. Ubuntu should also automatically create your new user’s folder under the Home directory.

Once finished, your new user will be able to login and enjoy the power of Ubuntu GNU/Linux!

If for some reason the login fails, please refer to the troubleshooting tips at the end of this article.

Step 3. Making future changes to users

Notice that if you wish, you can now go back and change the properties of this user by highlighting the user name and pressing the Properties button. Or, if this user is no longer needed or wanted in the future, you can highlight the name and press the Delete button.

If you ever decide to delete a basic user, realize that the folder and files from the user are not automatically removed, only the user’s login access is removed. This is greatly advantageous since it allows you to restore a previously deleted user without losing files.

In order to totally remove even the user’s folder, you will need to apply a super-user command. This is a step that is unlikely to be necessary for beginning Ubuntu, but that I explain briefly in the “Understanding the Superuser” section.

Don't miss out on the other pages!
12next ›last »

Write a full post in response to this!

0

Do you like this post?
Vote for it!

Copyright information

Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved.

Biography

Mark Rais: Mark Rais dedicates his time and energy to promoting free software technology, especially among the poor and where a technology divide exists. He serves as senior editor for reallylinux.com. You can contact him at "markr" followed by the "at" symbol and then "reallylinux.com".

Anonymous visitor's picture

Group privileges

Submitted by Anonymous visitor on Fri, 2006-08-11 16:43.

Vote!
0

Crucial to the use of groups is allowing groups access to directories and files. I am a beginning Ubuntu user (after two years, I still think I'm a beginner!) I've set up Samba so the Ubuntu machine can act as a file server.

Please correct these instructions if I remember them incorrectly:

Pick a directory you want the group to share say group: games, directory /games_dir.
As root create the directory
mkdir /games_dir

change the ownership so the group is always games and the group will be inherited in subdirectories (-R)
chown :games -R /games_dir

change the permissions so that the owner and other members of the group can read and write. Those outside the group can do nothing. The initial "2" sets the "sticky bit" for the group permissions.

chmod 2660 -R /games_dir

WIthout these ownership and permissions settings, whenever I saved pictures from my wifes account to /pictures I'd be unable to edit them later. This way, we can both read and edit.

Anonymous visitor's picture

Corrections

Submitted by Anonymous visitor on Fri, 2006-08-11 17:32.

Vote!
0

A very nice read indeed, especially for casual Linux users.

However, there are some small misspellings, that take away some fun of reading your article:

  • (Page 1)
    Ubuntu should also automatically create your new user’s folder under the /home directory.

  • (Page 2)
    cd /home
    sudo rm -rf john

    (I can't remember "delete" command, really)

  • The errors you may see include: $HOME/.dmrc not properly configured, or that the /home/user does not exist.

Don't forget about "sudo userdel -r john" which does two things at once: it removes the user's account and their home directory in one shot.

And for NOT enabling the root's account but still be able to run programs on his behalf:

sudo bash

(remember, in Linux there are more ways to do the same thing)

Regards,
SirYes

Anonymous visitor's picture

shell under root

Submitted by Anonymous visitor on Fri, 2006-11-03 09:21.

Vote!
0

>And for NOT enabling the root's account but still be able to run programs on
>his behalf:

This works also and gives you the root environment:

sudo su -

>(remember, in Linux there are more ways to do the same thing)

ciao ek

allanregistos's picture

Home users/groups

Submitted by allanregistos on Sat, 2006-08-12 06:34.

Vote!
0

I will create these groups for home users:

kid
boy
girl
adult
parent
family

A boy or a girl under the age of 18 will have the group kid as their secondary group. Same to boy or girl 18 above will have the group adult as secondary. Parents of course belongs to the parent group and will have no secondary group. All users have access to contents of the family group. In this way, I can manage contents that are unique for each home users. Just a thought..

Anonymous visitor's picture

Simultaneous Screen Users ala Windows XP?

Submitted by Anonymous visitor on Sat, 2006-08-12 07:27.

Vote!
0

I know that Linux is a multi-user OS, however, I'm wondering if there is a way to have multiple users on a single physical screen ala Win XP.

This is a nice feature - allowing multiple users to use different logins on the same physical screen without forcing either one to log out and terminate their respective applications.

This would be very useful, for instance, when I have visitors over and I want to let them use my system, but I don't want them use my login and I don't want to terminate my running programs. They would instead use a guest account running from the same screen.

I know there's the possibility of running multiple X servers, but this seems cumbersome.

Cosmo Lee
cosmolee at bigfoot dot com

Anonymous visitor's picture

Loging in second user when another user is active

Submitted by Anonymous visitor on Sun, 2006-08-13 04:52.

Vote!
0

Cosmo: yes, you can log in another user without logging out the previous one. To do this, choose "Switch User" from the "Quit..." menu item under the "System" menu (can also be accessed by clicking on the open door with arrow found on the right-top of the desktop).

Anonymous visitor's picture

Simultaneous screen users

Submitted by Anonymous visitor on Mon, 2006-08-21 14:30.

Vote!
0

Furthermore, you can choose to open several sessions from one session either in fullscreen or in nested windows!

Anonymous visitor's picture

Thank you

Submitted by Anonymous visitor on Mon, 2006-08-21 22:35.

Vote!
0

I wanted to take a moment to thank each of the readers who took time to reply on the article.

Indeed it is my hope to write more articles regarding Ubuntu and appreciate your kind replies and guidance on some of the notations above.

with kind regards,
mark rais

Anonymous visitor's picture

Administrator Deletion

Submitted by Anonymous visitor on Mon, 2006-08-28 02:06.

Vote!
0

I was given a Hard drive with Ubuntu installed, but since I wanted to be the Administrator now that I deleted the existing admistrator but now I canon load programs without the password and I cannot restor the administrator account even to' I can log in as Adinistrater using his name and password.
System/Administration section is only half the size now.
Can anyone help please. I am loosing all respect for Ubuntu and I din't want this, I realy want to mak it work.
Rex Gladding
rexd@istnet.net.au

Anonymous visitor's picture

Unrealistic expectations

Submitted by Anonymous visitor on Mon, 2006-09-18 08:44.

Vote!
0

Don't lose respect for Ubuntu for your mistake. If you made that type of mistake in Windows, you would experience the same problem.

You obviously are not very experienced with computers, so maybe you should take your computer to the local repair shop where they can help you out.

Anonymous visitor's picture

reinstall

Submitted by Anonymous visitor on Fri, 2006-09-29 16:23.

Vote!
0

Do that kind of thing to any multiuser OS and it'd be broken!

Another option after killing an installation in this way is to reinstall -- go to Ubuntu.com and ask them to send you a new CD. It's probably easier that way, and you'll learn stuff :-)

Anonymous visitor's picture

same thing happened to me

Submitted by Anonymous visitor on Sun, 2007-02-25 17:38.

Vote!
0

This would NOT have happended in windows actually. Becuase in windows you cannot delete the the administrator account. So the one reply to your post, that guy dosent know about computers.

Anonymous visitor's picture

The fix

Submitted by Anonymous visitor on Mon, 2007-04-02 20:27.

Vote!
0

If you boot your system into single user mode:
http://wiki.clug.org.za/wiki/How_do_I_reset_my_root_password%3F

Then add a user: yourusername

then just make sure to add your user to the "admin" group, reboot and you are good to go. If you need more help, you can contact me (sharms on irc.freenode.org) and ask on #ubuntu

Anonymous visitor's picture

If you were given a disk

Submitted by Anonymous visitor (not verified) on Sat, 2007-11-24 13:40.

Vote!
0

If you were given a disk with another install already on it, you may already have built in problems and the easiest and cleanest thing to do would be a reinstall. If you can access a system with internet access you can download an image of feisty fawn from ubuntu.org, make a cd, and boot to it. Double-click Install... you will have to give it user information, and choose a password. Write it all down! Choose to overwrite the current install, have a cup of tea, or two, and you will have a fresh, clean start.
It's very important to be patient, and persist. It took me 3 years to really learn windows, and Linux is no different. Theres a learning curve to any OS, but persistance, and patience is the key. Solving your first problem may take awhile and a lot of research and trial and error, the second will come easier, and so forth, and it really won't be long, you'll wonder why the whole world isn't using Linux.
Unless you are wealthy in the extreme, you will never be able to afford to do the things in Windows that you can in Linux for free.

vgrisham's picture

Am I root?

Submitted by vgrisham on Tue, 2006-11-14 21:24.

Vote!
0

My account is the account created on install. I can create users and am apparently a superuser. When I try to install software (firestarter) however using apt-get, I get a message that says:

E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

What am I doing wrong?

Thanks in advance.

Anonymous visitor's picture

sudo

Submitted by Anonymous visitor on Thu, 2007-02-15 03:31.

Vote!
0

apt-get needs to be run as root. In ubuntu, that means the command would be:
sudo apt-get

Anonymous visitor's picture

to not have to type "sudo"

Submitted by Anonymous visitor (not verified) on Tue, 2007-05-22 05:04.

Vote!
0

to not have to type "sudo" in front of every command, you can type "sudo -s" and you will be root, and you can type all commands normally.

Anonymous visitor's picture

Are you using sudo?

Submitted by Anonymous visitor on Sat, 2006-11-25 01:23.

Vote!
0

Are you using sudo?

Anonymous visitor's picture

this article

Submitted by Anonymous visitor on Wed, 2006-12-06 08:04.

Vote!
0

What is the point of this article if you use the GUI?
The comments are more useful than the article it self.

Anonymous visitor's picture

Not able to login to destop UBUNTU.

Submitted by Anonymous visitor on Mon, 2006-12-11 08:10.

Vote!
0

I have installed a fresh copy of UBUNTU. In login screen I enter the correct user name and the password. Even then its not accepting the username and password and so i am not able to login. Could you please suugestme how exactly i can know about the login username and password.

Anonymous visitor's picture

same problem here

Submitted by Anonymous visitor on Mon, 2006-12-18 10:20.

Vote!
0

I also installed ubuntu without any problems. It never asked for a username or password, but now I want to start and all it does is asking username and password.

Anonymous visitor's picture

Cannot log in...

Submitted by Anonymous visitor on Sun, 2007-02-04 06:49.

Vote!
0

I renamed my administrator account and changed the default home dir. now i cannot log in as the home dir doesn't exist. I have created a new user but only with limited rights. is therte a way i can restore my orginal login?

BobT_KY's picture

I did this as well and had

Submitted by BobT_KY (not verified) on Tue, 2007-06-26 16:03.

Vote!
0

I did this as well and had to startup a failsafe terminal session (use F10 when logging in to get safe mode menu options). I then used "su" to switch to root. Created /home/new__username and used "chown" new_username /home/new_username. I then had to hard shut down the PC (could not figure out how to exit the root temrinal session, tried "exit" "quit," ctrl-z, ctrl-c etc.) and logged in as new_username and all was ok.

Anonymous visitor's picture

mouse not dectated

Submitted by Anonymous visitor on Wed, 2007-02-07 07:09.

Vote!
0

in my ubuntu mouse is not deteacting so help me to activate my mouse

Anonymous visitor's picture

1. check to see if it's

Submitted by Anonymous visitor (not verified) on Tue, 2007-05-22 05:06.

Vote!
0

1. check to see if it's plugged in.
2. check to see if it works on a nother computer.
3. try rebooting
4. come back here.

Anonymous visitor's picture

about settings on the internet

Submitted by Anonymous visitor (not verified) on Wed, 2007-07-11 13:06.

Vote!
0

i installled ubuntu, i did this thing with the admin settings. but i cant get acces in the internet settings. it beheaviour like i dont done the step before. i cant type my ip adres, my username and anything else. what to do?

Anonymous visitor's picture

I assume "john" is Mark's

Submitted by Anonymous visitor (not verified) on Thu, 2007-07-12 23:15.

Vote!
0

I assume "john" is Mark's 'partner'.

MRais's picture

John?

Submitted by MRais (not verified) on Wed, 2007-07-18 01:23.

Vote!
0

Hmmm.

Actually, I have been writing so many user guides that I ended up just using "John Smith" and/or "John" as simple example users.

Note that I use "John Smith" more like "John Doe" than someone specific like "Captain John Smith". ;)

newlyweds's picture

sudo permissions

Submitted by newlyweds on Wed, 2008-01-30 18:28.

Vote!
0

I have some folders i cant get into with my initial user priviledges. I am very new to using another type of operating system such as linux but with ubuntu it is a fairly easy transition thus far. My friend is a tech nerd and is the one who installed it for me but he is deployed and i want to try to resolver this my self.

here is the issue.

I have two folders that are designer within my hardware for mass storage but I do not have read, write, or execute permissions to them is there a way that I can essentually give myself aka my account the neccessary permissions to them. my friend believe they fall into the root permissions or something like that.

Any help would be amazing!!! when replying please refer to my username. LOL thanks

jpmd's picture

How to manage users and groups from terminal window?

Submitted by jpmd on Sat, 2008-06-14 21:32.

Vote!
0

This tutorial is excellent: clear and easy to follow.

I'm curious, however, how to do all this from a terminal window. I built a LAMP server with Ubuntu 8.04 and I want to avoid installing the GUI if I can.

I'm using PuTTY to access the Ubuntu box remotely, hoping to make it a headless web server.

I'm pretty new to the whole Linux thing, as you can tell.

Thanks for your help!

John



CariNet: Cloud computing is a reality.

Other sites

Odiogo

Free Software Magazine uses Apollo, project management and CRM for its everyday activities!