How can I switch users from within XFCE?

Solution 1:

enter image description here

In a terminal:

sudo apt-get install xfswitch-plugin

During installation it will ask you to switch window manager - do not choose GDM, but stick with lightdm. N.B. since its a text screen press TAB to navigate to "OK" and press ENTER

Right-click and add a new panel item - User Switching

Solution 2:

You can click your user name in the top panel and then select "Lock Screen." From the locked screen select "New Login" and it will take you back to the LightDM screen where you can click a different user name and enter the password. The first user is still logged in and you can switch back and forth this way.

Solution 3:

If you don't want to bring in the whole of gdm and dependencies, you can just create a launcher that achieves the same thing. Put this

#!/bin/sh
zenity --question --text "Switch user?" --title "New login" &&
gdmflexiserver --new

into a file called fast-user-switch, then do

chmod +x fast-user-switch
sudo mv fast-user-switch /usr/local/bin/

Then add a Launcher plugin to your panel, edit the menu and click the button with a white paper with a plus on it, there you can just type in fast-user-switch (it should auto-complete while you type if you did the past steps correctly), and select a nice icon (search for switch for a fitting one …)

Note: The next version of XFCE, 4.10, will include a Switch User button in the Actions plugin, and deprecate the session menu.

Note to the note: if you have kdm instead of gdm/lightdm (kdm+xfce may be an odd combination, but it happens), the 4.10 Switch User button doesn't work. However, the following bash script works, and additionally lets you either log in as a currently logged in user, or start a new login:

#!/bin/bash

set -f              # no globbing, so we can safely use *

# other_local[joe]=:0, other_local[bob]=:1 etc. for all active local
# users other than us:
unset other_local; declare -A other_local; 
while read -rd $'\t'; do
    IFS=$',\n' r=($REPLY)
    [[ "${#r[@]}" -ge 4 && "${r[4]}" != '*' && "${r[2]}" != '' && "${r[0]}" != '' ]] && other_local[${r[2]}]=${r[0]}
done < <(kdmctl list alllocal)
IFS=$',\n' r=($REPLY)
[[ "${#r[@]}" -ge 4 && "${r[4]}" != '*' && "${r[2]}" != '' && "${r[0]}" != '' ]] && other_local[${r[2]}]=${r[0]}


user_choice=$( printf "%s\n" "${!other_local[@]}" "New login" |\
    zenity --list --column User --text 'Switch to an active user, or start a new login:' --title 'Switch user?' ) || exit 1

case $user_choice in
    "New login" ) kdmctl reserve ;;
    * ) kdmctl activate "${other_local[$user_choice]}" ;;
esac

Solution 4:

Lock screen, and when prompted to login, click "New login".

(Works on 12.04, but it probably works on 11.10 too)