From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96079072815941.tru64-unix-managers.marc@archive.invalid> From: "Edwin R Wolfe Jr." Date: Tue, 07 Sep 1999 21:59:40 +0000 To: tru64-unix-managers Subject: Summary: is there a way to execute a script when logging out? X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96079072815941 Thanks to the following for their responses: Billy Quinn Davis, Alan Stan Horwitz Matt Moore John Vaughn Ryan Grisso Paul Scowen Carroll Hyatt Brown, Phillip Barry Treahy Lucio Chiappetti daiken@regents.edu Dima Slavutskiy Special thanks to Phillips, Brenden for pointing out that "and you are REALLY lucky that it didn't!!!" (that rm -rf .* didn't get executed) "rm -r .* will first match .. which will move you all the way up to the root dir, and then proceed thru every directory mounted on your system! You should use rm -r .??* or find . -name ".??*" -type f -exec rm {} \; to recursivly delete dot files" Fortunately, I did my testing not as root, and an error message about not being owner showed me the horror of what I was attempting before any damage occured. Most of the responses indicated that the execution of a logout file is shell dependent, and this file usually must be owned by the user (my attempt was owned by root, so didn't get executed). A system wide logout can often be put into /etc/shell_specific_logout. Trouble is, a user can change the login shell to one that doesn't do a .logout. It was suggested to put a trap '$HOME/.logout EXIT in the .login file or a trap ". ~/.logoff" EXIT in the .profile file but I couldn't get this to work, as the trap command seems to be shell dependent. Another idea was to change the login shells to telnet or rlogin or run in text mode, but this wouldn't quite do what was needed as users typically open several windows and/or run several graphical programs at once. Quite by accident I discovered that, if the home directory is non-existant, the user logs in with a home directory of root. So I changed them all (all but root and a few others) to /usr/users/usrname (could have set them all to /usr/users/qq, I suppose) and it looks like this will do what we need. The CDE does not run, and all you get is an xterm and a console window, but users can xhost +somewhere and xterm & ; rlogin somewhere all they want. So, the machine is now just a webserver and, if need be, an extra monitor in our lab; which is what was wanted. ^^^^^^^^^^^^ The original question: > In VMS there can be a logout file that is executed, typically to clean a > user's directories and so on. Is there such a capability in DU? > > What we're trying to do is this: we have an older machine that we're > demoting to basically just be a departmental web server. We've removed > any discs that it used to export, and changed its fstab file to not mount > any discs other than its own internal disk. But, because it does have a > monitor (which presents the dtlogin screen), we want to allow our users to > be able to login to it with the expectation of telnetting to our other > machines. > > We've changed the passwd file to make everyone's home directory be /tmp > (except root), because the local disk doesn't have much space. Of course, > the result of that is that the first user to login is the only one allowed > thereafter because of the ownership of certain files in /tmp. > > We tried creating a .logout owned by root (so it won't get deleted), and > executable by anyone, that does a > > cd /tmp > rm -rf * > rm -rf .* > > but it doesn't seem to get executed. > > Can anyone suggest how we can attain this shared home directory behavior > whether using dtlogin, rlogin, telnet, etc?