Howto run privileged commands on login/logout

perryh at perryh at
Sun Feb 7 04:03:09 UTC 2010

Erik Norgaard <norgaard at> wrote:
> I'm playing around with diskless operation. I'd like to be able
> to run privileged commands when a user logins or logs out:
> - on login, nfs mount the user's home directory (ok, not critical,
> I can mount /home)

Or, better yet, use an automounter.

> - on logout a system reboot to clean up any temporary files left
> from the session.

I'm not aware of any existing, simple method to handle this part.
It might not be all that difficult to hack something into getty(8)
or init(8).  Another possibility would be to clean /tmp and /var/tmp
in the .logout script, which should not require any special privs.

More information about the freebsd-questions mailing list