On Fri, 9 Jan 2004, Bart Garst wrote:
> I was wondering how I would go about logging off a user.
>
> Scenario:
> I have a user logged in named foo. I want to log him off. As root, what
> command would I use to accomplish this?
There are many ways to accomplish this, but here's an example:
root@server:~# w
10:25:58 up 153 days, 18:24, 1 user, load average: 0.01, 0.08, 0.11
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/1 10.1.1.100 10:25 0.00s 0.04s 0.04s w
root@server:~# ps aux | grep pts/1
root 17864 0.0 0.1 5356 1540 ? S 10:25 0:00 sshd:
root@pts/1
root 17866 0.0 0.1 2100 1176 pts/1 S 10:25 0:00 -bash
root 17879 0.0 0.1 3132 1296 pts/1 R 10:26 0:00 ps aux
root 17880 0.0 0.0 1404 488 pts/1 S 10:26 0:00 grep pts/1
root@server:~# kill 17864
Bye-bye user session
Note: this is pretty rude to the user, so you'll want to pipe a warning to
him/her first. Or if you mean to be rude then I guess this is fine. :-)