Logging out users

Hi,

How do force users to log off Unix through shell?

Perhaps you could kill them (metaphorically speaking, or course), or more specifically their login shells.

/root # ps -ef | grep -- -ksh
root      3862  3855  0 19:34 pts/1    00:00:00 -ksh
root      3863  3860  0 19:34 pts/2    00:00:00 -ksh
oracle    3958  3957  0 19:34 pts/1    00:00:00 -ksh

/root # kill -9 3958

/root # ps -ef | grep -- -ksh
root      3862  3855  0 19:34 pts/1    00:00:00 -ksh
root      3863  3860  0 19:34 pts/2    00:00:00 -ksh

pkill is a good (and as root dangerous!) way to kill lots of things at once (use pgrep first to find what you want).

If you want to ask them nicely first, you can use wall, or write, or issue a delayed shutdown command (remembering to cancel it of course!). That should get their attention.

If the O/P had stated Operating System and Shell and the method of connection and provided examples of "sessions to kill" and "sessions to not to kill" we could have possibly scripted a solution.
There is too much variety in connection methods and the "ps" command to guess.

For example: Assuming they log in with telnet:
Find the telnet process applicable to that terminal only and kill it with "kill -15" (hangup). With a conventional application this should cause a tidy cascade kill of the subprocesses.

Ps. It is a common mistake to just kill the shell. This tends to leave looping processes.