Find the answer to your Linux question:
Results 1 to 4 of 4
I'm just wondeirng how you go about logging someone off a machine? It's been bothering me for awhile and up till now I've just been letting it time out, but ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Nov 2004
    Posts
    127

    Logoff Remote Users


    I'm just wondeirng how you go about logging someone off a machine? It's been bothering me for awhile and up till now I've just been letting it time out, but I'd really like to know the answer.

    In otherwords when you type "who" and get a list of users logged into the system. I'd like to be able to log off people on that list (since sometimes they have been disconnected or I just want them out. I of course have root access. I'm sure it must be something simple like a logoff command but I've never found it.

  2. #2
    Linux Engineer
    Join Date
    Apr 2005
    Location
    Buenos Aires, Argentina
    Posts
    908
    Kill their ssh session, get the PID and just kill it. For example:
    Code:
    root@insitt:~# ps aux | grep ssh
    root     16182  0.0  2.3   3368  1484 ?        Ss   Sep13   0:00 /usr/sbin/sshd
    root     13185  0.8  2.7   5928  1704 ?        Ss   00:23   0:00 sshd: serz [priv]
    serz     20614  0.5  2.8   5928  1736 ?        S    00:23   0:00 sshd: serz@pts/0
    root@insitt:~# kill 20614
    That would do it
    serzsite.com.ar
    "All the drugs in this world won\'t save you from yourself"

  3. #3
    Linux Newbie
    Join Date
    Nov 2004
    Posts
    127
    OK, I thought that was going to work, but I"m still having problems. Although maybe it's my fault. Maybe I'm not looking at ssh users. Here is what I did below.

    [root@servername root]# service sshd stop
    Stopping sshd: [ OK ]
    [root@servername root]# who
    root tty1 Sep 14 22:25
    root pts/35 Sep 14 11:57 (:0.0)
    root pts/37 Sep 14 13:38 (:0.0)
    root pts/39 Sep 14 13:53 (:0.0)
    root pts/40 Sep 14 22:31 (:0.0)
    [root@servername root]# ps aux | grep ssh
    root 30922 0.0 0.0 0 0 ? Z 23:04 0:00 [ssh-agent] <defunct>
    root 31138 0.0 0.0 42828 596 pts/40 R 23:10 0:00 grep ssh
    [root@servername root]# kill 30922
    [root@servername root]# ps aux | grep ssh
    root 30922 0.0 0.0 0 0 ? Z 23:04 0:00 [ssh-agent] <defunct>
    root 31140 0.0 0.0 42828 596 pts/40 R 23:11 0:00 grep ssh

    So as I understand it, I got nowhere. But I think that's my fault because I'm gathering that perhaps pts/ users arn't remote? Anyways, all I know is none of those four pts/ users were listed before and I'd like to see them gone.

  4. #4
    Just Joined!
    Join Date
    Jun 2011
    Posts
    1
    The following command has helped me in the past, 'sudo' may or may not need to preface it:

    pkill -KILL -u username

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •