Managing users in Ubuntu

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

User space | Easy

By Mark Rais

Online on: 2006-08-09

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.



License

(C) Mark Rais 2007

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

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

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

>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

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?

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

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

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

Anonymous visitor's picture

Thank you

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

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

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

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

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

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

vgrisham's picture

Am I root?

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

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"

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?

Are you using sudo?

Anonymous visitor's picture

this article

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.

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

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...

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

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

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

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

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

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

MRais's picture

John?

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". ;)

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options


[The Top 10 Everything] [Zoeshire] [FSDaily RSS] [Book Reviews - Illiterarty]