Click to See Complete Forum and Search --> : kill remote ssh session


Syngin
02-14-2005, 11:10 AM
Hi guys,

I accidentally left myself logged in to my server via ssh at home and need access to the program I was using there. (at work now) When logged in as root, how can I kill this old user session that is still logged in?

Thanks.

ph34r
02-14-2005, 12:25 PM
Kill their bash session

pezplaya
02-14-2005, 01:04 PM
type

who -a

get the pid of the loggedin user

then

kill #pid

Syngin
02-14-2005, 01:53 PM
Thanks pezplaya. Haven't used 'who' before.

serz
02-14-2005, 07:48 PM
Originally posted by pezplaya
type

who -a

get the pid of the loggedin user

then


That's indeed useful, but it's not working for me.

Could that be a script or something? I looked at the who options and the man page and there's no such option.

madcompnerd
02-14-2005, 11:33 PM
-a, --all
same as -b -d --login -p -r -t -T -u

psi42
02-15-2005, 09:40 AM
who -a works for me.


maedhros@himring:~$ who --version
who (coreutils) 5.2.1
Written by Joseph Arceneaux, David MacKenzie, and Michael Stone.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

pezplaya
02-15-2005, 12:01 PM
Ya it is a very useful thing to know. I don't know why it doesn't work for you.

who --help or man who shows what madcompnerd said. Try one of those other options.

my output:
bash-2.05b$ who --version
who (coreutils) 5.2.1
Written by Joseph Arceneaux, David MacKenzie, and Michael Stone.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

what version are u running? When i look at my man page, who -a is the first option that comes up.

retsaw
02-15-2005, 02:07 PM
In this situation, I'd just kill the program and restart from where I want to run it.

Also this is a situation where "screen" would be useful, with screen you can detach a remote session and reattach it where you are currently, or you could multiplex it so you have the same session open at two or more locations, it's also useful in case your ssh connection gets broken, screen will keep your session alive. I know you weren't asking about this, but I thought I'd mention it anyway as you may not have heard of screen.

serz
02-15-2005, 07:42 PM
root@insitt:~# who --version
who (GNU sh-utils) 2.0
Written by Joseph Arceneaux and David MacKenzie.

Copyright (C) 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I guess that's why :)

I was sure I had coreutils installed, weird.

Thanks.

pezplaya
02-15-2005, 11:57 PM
Originally posted by serz

root@insitt:~# who --version
who (GNU sh-utils) 2.0
Written by Joseph Arceneaux and David MacKenzie.

Copyright (C) 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I guess that's why :)

I was sure I had coreutils installed, weird.

Thanks.

ya... that might be the reason :p.

good luck