How to disallow logout

jhell jhell at DataIX.net
Sat Sep 11 10:53:35 UTC 2010


On 09/11/2010 05:07, Peter Pentchev wrote:
> 
> ...but, of course, that's only until people learn that they can 
> bypass this by something like 'kill -FPE $$'.
> 

Have you tried that ?

If the person/developer is looking into it that far where they need to
subvert the logout process then there is probably a pretty good reason
for doing so and would be expected that they bring it to the admins
attention or file a PR.

There is only just so much you can do before you start to modify the
code in the shell itself so the user cant execute another shell upon
login and kill their shell before other scripts run on logout.

Firstly this just sounds like a case where the admin needs to provide a
equally sound and safe way of making sure everything is cleaned up on
logout and is offering a global way of doing it so the developer will
not forget.

trap 'echo "Sorry FPE not allowed. ;)"' FPE

( kill -l ) will list the rest of the signals you can trap too.

And you can get pretty evil with this. But for the short term.

for sig in `jot 31 1`; do
  trap 'echo "WARN:$$ Please use ^D or logout(1) instead."' ${sig}
done

Of course not all of those signals will cause a logout to happen but
have fun with it.


Regards,

-- 

 jhell,v


More information about the freebsd-hackers mailing list