Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I automatically umount usb flash drives left mounted by guests

Status
Not open for further replies.
Dec 18, 2002
59
GB
Hi Gurus,
I have fedora4 system shared by many users loging in to the same guest account, I have a problem with them leaving thier flash drives still mounted for the next user, Is there a way to automatically umount all the devices such as /dev/sdb1, /dev/sdb2, /dev/sdc1 and so on.... Please help your help would be much appreciated. Thanks
 
Googling around the net, I found this:

-----------------------------------------------------------------
>> Shell Tip: How to execute a script for each logout
-----------------------------------------------------------------

Sometimes it's useful to execute a command after each
logout, i.e. to cleanup temporary directories, or to log
working hours.

This is the way to make the shell execute the script
$HOME/.logout after each logout:

1. Insert this line at the beginning of the file
$HOME/.profile:

trap ". $HOME/.logout" 0

2. Create a file named "$HOME/.logout", that may contain
arbitrary shell commands, i.e.

$ cat > $HOME/.logout
echo "Good bye $LOGNAME, the time is `date`"
^D

That's it! After the next login, the shell will execute
the contents of the file "$HOME/.logout".

NOTE: this will not work for C-Shell dialects, i.e. TCSH



Of course, you will need to set the .logout script so that it looks for and umounts (if found) any flash drives.

the URL for the above segment is:


scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top