Re: Bash script to logout user from console

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Apr 24, 2008 at 11:48 PM, Joseph L. Casale
<jcasale@xxxxxxxxxxxxxxxxx> wrote:
> I am stumped to figure out how to logout a user after they run a script
> interactively when logged into the console. I see how to do it if in x, but
> this server does not have x installed.

There are 2 possible interpretations to your post.

1. You want the last action of the script being run by the user on the
console to log out the user. In this case make the last command of the
shell script

kill -HUP `pgrep -s 0 -o`

This kills the login shell.

2. The user neglects to log out and you as root wish to force a logoff
without having to go to the console. The console session will have a
parent process that shows as "login -- <username>" in a ps -ef output.
Kill that process.

-- 
Jeff
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux