7

What is the Ubuntu equivalent of this interface?

How to log off a user in windows 7

I am looking for a user-friendly method that the owner of a computer can use to log off other users without having to restart.

The case I'm concerned about is of the beginner-level user who needs administrative control over the computer because they are the owner, but probably isn't concerned with most of the tasks we would usually associate with system administration.

  • There is no equivalent GUI interface that I know of for this. – Thomas Ward Jun 12 '17 at 13:54
8

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.

  • What if I am trying to disconnect a session I initiated? Will this not kill my other current processes including the terminal that I am currently using? – Lord Loh. Oct 30 '13 at 23:05
  • @Lord Loh Yes. If that's the case, then use the -t parameter to pkill to specify which terminal you want. I.E.: if you have a graphical login on tty7 and a remote login on pts/0 you could do pkill -u <username> -t pts/0 and it will kill everything running on that one pty. There are lots of other filters available too, see the pkill man page for details. – Perkins Sep 12 '14 at 18:36
  • If user have multiple sessions with different tty and pts sessions. Is there any way we can kill specific session ? – rɑːdʒɑ May 12 '16 at 3:49
  • 1
    @Raja As above, use some combination of -u <username> and -t <tty> to filter it down to the user and tty session you want to stop. There are a bunch more filters that might be useful as well, check out the pkill man page for descriptions. – Perkins May 12 '16 at 22:01
1

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
0

From an Administration point of view, there really is no better GUI than your terminal

Terminal command

  • This is true with regard to system administration proper, but the case I'm concerned about is of the beginner-level user who is the "administrator" of their home desktop computer merely by necessity. This type of user should have control over the computer because they are the owner, but probably doesn't perform most of the tasks we would usually associate with system administration. – ændrük Jul 13 '11 at 20:27
  • 1
    Killing all user process with SIGKILL, can leave to unconsistent user data, because processes do not have the chance to close gracefully. Never use SIGKILL without have tried other less dangerous signal before. – enzotib Jul 13 '11 at 20:49
  • 1
    If wojox runs this, will the current terminal dot die as well? – Lord Loh. Oct 30 '13 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.