Bash script to logout user from console
On Thu, Apr 24, 2008 at 11:48 PM, Joseph L. Casale
> 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
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.
CentOS mailing list