Switching Users



 

 


One feature of Linux that cannot be duplicated by Windows is that Linux is not only multitasking, but it is also multiuser. This means that unlike Windows, multiple users can be logged into a single computer simultaneously. This is handy for an administrator like myself, because I can login to another computer remotely and perform upgrades and make configuration changes while the person sitting in front of the computer continues to work on her spreadsheet. Of course I am not using the Desktop while I perform these tasks, primarily because — take my word for it — the command line is much more efficient for those tasks. But I could login to the remote computer using the GUI Desktop using tools that come free with Linux, should I so desire.

Virtual Terminals

Linux has always — at least as long as I have been using it — provided the capability for multiple logins. Red Hat Linux and Red Hat Fedora Linux have typically provided for 7 virtual terminals for text mode logins. If a graphical interface were used, it was assigned as virtual terminal 7, or vt7. In this case vt1 through vt6 would be text mode sessions and vt7 would be the graphical session. Each virtual terminal is assigned to a Function Key corresponding to the terminal number. So vt1 would be assigned to function key F1, and so on.

Starting with Fedora 11 the first Virtual Terminal, vt1, becomes the first graphical (GUI) session. and vt7 becomes the second GUI session. I am not sure why this has changed.

It is easy to switch to and from these sessions. On your computer you can hold down the Ctrl and Alt keys and press F2 to switch to vt2. Then hold down the Ctrl and Alt keys and press F1 to switch to vt and the graphical interface.

Figure 15: The bottom of the KDE Menu provides options to lock the session, logout and switch to another user.

Figure 1: The Leave tab of the KDE Menu provides options to lock the session, logout and switch to another user.

Recent (as of this writing) versions of Fedora, starting with Core 4 and through Fedora 11 (They have dropped the “Core” designation) allow multiple GUI logins for users at the keyboard. This means that another user can sit down at your computer and use it while you are still logged in. You cannot both use the computer at the same time if you both have to use the same monitor, mouse and keyboard, but you do not have to logout in order to let someone else have access to it. This is useful if multiple users share the same computer, or if a guest just needs temporary access to a computer.

Although you may never need this feature, I found it to be of great value in the writing of this book. It allowed me to login as multiple users and make screen shots of user accounts with “pristine” desktops, which mine is not.

Starting a Session as a New User

There are two ways to begin switching to a new user. First, you can right click on the KDE Desktop and the Desktop pop up menu provides the three options, Logout, Lock Session, and Switch User. The KDE Menu accessible from the KDE Panel Menu Icon also provides these same three options. Click on the green Switch User menu choice and your have to more options as shown in Figure 1. One choice is to lock the current session and start a new one, and the other choice is to simply start the new session.

Figure 2: The KDE Switch User submenu.

Figure 2: The KDE Switch User submenu. In this instance there is no other user except ourselves currently logged in.

Figure 2 shows the KDE Switch User sub-menu when there is only one user, myself, logged in. The only option is to start a new session for a second user.

Figure 3: The Start New Session sub-menu when there is already another user logged in. You can switch to that user or start a new session.

Figure 3: The KDE Start New Session sub-menu when there is already another user logged in. You can switch to that user or start a new session.

In figure 3, there is already another user besides ourselves logged in. You can either switch to that already logged in user or start a new session for yet a third user to login.

Figure 4: The New Session warning message tells you how to switch between active sessions.

Figure 4: The New Session warning message tells you how to switch between active sessions.

The session you switch away from is automatically locked. This is for security purposes because the usual reason for switching users is to allow another user access to the computer. You do not, however, want that other person to be able to switch back to your session and possible view or damage sensitive data, either accidentally or intentionally.

After clicking on the desired menu choice for starting your new session, the New Session warning window is displayed, as shown in Figure 4. This window describes the two ways in which you can switch between active sessions.

Switching Between Sessions

In Figure 3, there is another user already logged in, and there is the possibility that several may be logged in. The active session is the one listed at the top of the window, in the case of Figure 3, tuser1 on vt7. Simply click on the icon for the session you wish to switch to. The first graphical session is assigned to vt7 and the second would be assigned to vt8 and so on. It is not possible to use the Switch User submenu to switch to a text mode session in virtual terminals one through six.

The other option you have for switching between sessions is explained in the New Session warning message shown in Figure 4 and in the text above. You can hold down the Ctrl and Alt keys and press the function key that corresponds to the virtual terminal in which the desired graphical session is running. Using this method to switch sessions also allows you to switch to one of the text mode sessions in virtual terminals one through six.

Ending a Session

It is very easy to end a session. Simply logout as you would if there were only a single session. Use the KDE Menu, the Desktop Menu, or the Lock/Logout button on the KDE Panel if you have added it there, and click on the Logout icon. This will close the currently active session and return you to the previous session. You can also lock your session and switch back to the previous one.

When all users have finished using the computer, be sure to logout of all active sessions.