User switching in the Linux desktop
Linux is a true multi-user system. What that means is you can have multiple users logged inÂ concurrently. There are so many advantages of this on so many levels. Many modern Linux desktops and distributions take advantage of this multi-user environment from bottom to top. The bottom level (at the kernel) is not so obvious to the naked eye. At the top level (the desktop) the use of multi-user becomes quite apparent.
One way this is used is the ability to quickly and easily switch between users. The switching back and forth between users does not require User A or B to log out of the system. In fact, they can keep all of their applications running and when the system is switched back to them, everything will be just as they left it. It's as if they just locked their screen, stepped away, and came back to work. In this article I am going to show you how this is done - as well as what it takes to make it happen.
What you need
Obviously you need more than one user. Without more than one user you can't switch users. To illustrate this task I created a second user (one that I now often use for writing on Ghacks). That user is "Olivia Dunham" (from my favorite TV show Fringe - as if you had to guess). If you are going to be doing this for testing purposes you will first need to know about creating users. This is actually quite easy. But there is one thing you will want to look out for.
When you create a new user on a Linux system, by default, that user does not have any administration privileges. In a Ubuntu system this means they are not in the /etc/sudoers file. That user will not be able to install applications or do anything that requires root access. That is fine and good for standard users, but if that user does need admin privileges you need to be able to give it to them. To do this click on System > Administration > Â Users and Groups.
In this new window select the user you need to edit and then click Advanced Settings. Â After you give your admin password you will see the Advanced User Settings window. In this window click on the User Privileges tab (see Figure 1). In this tab make sure you check everything this new user needs to be able to do and then click OK. The user should now have the privileges they need.
Now, back to the user switching.
Making the switch
If you click on the "Power" icon in the upper right hand corner of the GNOME desktop a new menu will appear (see Figure 2).
What you see, in Figure 2, is a menu that lists all usable users on the system. To switch to a different user all you have to do is select that user. What happens this is the following:
- The system will lock your current session.
- You will see the login screen with the user you selected ready to log in.
- You will be prompted for that users' password.
- After you enter the password you will be logged in.
As you can see, in Figure 2, there is a check by my name. That check means that that user is already logged in. That means the switch will be fairly fast. If the user isn't logged in that means the switch will be slowed down by the users' desktop having to be loaded. If you switch back and forth between users a lot, just leave those users logged in.
The switching of users on the Linux desktop perfectly illustrates the value of the true multi-user system. It's a very easy way to allow multiple users on a system at once and allow for quick switching back and forth of desktops.Advertisement