![]() |
Thanks, it was running as root and using $1 fixed it.
The working script now looks like :- #!/bin/sh -f username=$1 if [ "$username" = "fred" ]; then echo "bye" elif [ "$username" = "root" ]; then echo "bye" else rm -r /Users/$1 fi ------------------------------------------ One last question, the echo command seems "messy", is there another way to say if ... then do nothing ? |
Quote:
Code:
if [ ! "$1" = "fred" ] && [ ! "$1" = "root" ]Of course, given the extreme nature of what you are doing, you should test this script first. Chris |
Hayne, in the preceding reply, is correct. Login/logout hooks run as root. That's why you must use the $1 argument.
Anyways, just to provide some verification, I believe you're finally doing it right. When you log into a network user (i.e. a user from an Active Directory or an LDAP/Open Directory), the NetInfo database on the local machine isn't modified at all. All you need to do is delete the user's home directory from the file system. In my setup, all the students use the same login. However, just in case someone logs out accidentally or has a crash, I don't want to erase their data right away. My version of your script movies their home directory to a folder in /Library. I use a single 'rm' command via cron every night to clean the folder out. |
Thanks weltonch 777
Works a treat and is short and elegant. Yours is the one I'm going with. I will also use a version on login which "blows away" all the rubbish folders such as movies and sites. Thanks to everyone for their help. |
this is just what i was looking for, thnx to all the people that shared their knowledge
X@vier |
| All times are GMT -5. The time now is 10:21 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.