What is a user-friendly way to log off other users?

I don't know of any place where this is plumbed through to the GUI.

sudo pkill -u <username> 

is really the simple way to do it, followed by

sudo pkill -KILL -u <username>

a bit later if it doesn't all shut down like it should. If the "non-technical" user in question isn't capable of remembering that, a script to prompt for a username and then run those commands would be about five lines of code and could have a link to it placed somewhere convenient.


I use the following command:

 ps aux | grep ssh | grep "$USER@pts/" | tr -s ' '| cut -d ' ' -f2 | sort -n -r | head -n 1 | xargs kill -9
  • sort is used to kill the last connection.
  • replace $USER by the username if needed else it kills the connection of the user who run the command. Cordially Liloulinx