remote logoff question
Jeremy C. Reed
plug-discuss@lists.plug.phoenix.az.us
Tue, 17 Jun 2003 08:18:14 -0700 (PDT)
> ps auxw | grep vc/2
Some versions of ps(1) allow it to select by the tty name (maybe a "t"
option or --tty switch).
> You will be able to get the PID of the bash shell that is running on that
> terminal line. Now just
You may want to check for other shells too (like ksh, tcsh, whatever).
It might be easier to look for the sshd process instead, but that would be
hard if logged in as root, because main sshd would be root too. (And can't
check for tty name, because that daemon doesn't have any controlling
terminal.)
Maybe something like:
ps -o ppid --tty pts/1
> kill -9 xxxxx
SIGKILL is not trapped. It should be used as a last option. Using normal
SIGTERM or send SIGHUP (hangup) to a shell would be good so the processes
can clean up after themselves (save backups, remove lockfiles, et cetera).
Jeremy C. Reed
http://bsd.reedmedia.net/