Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 12-30-2006, 12:03 PM   #1
Registered: Jul 2003
Posts: 83

Rep: Reputation: 15
logout/exit script ??

Dear All,

I have a problem that I hope you guys can help by giving some suggestions.

I have a machine that is shared among several people. And I have setup a directory in there that is shared among all the users. This directory because of some reasons has to be also viewable from window OS that is dual booted off the same machine.
So I have that directory actually a mount directory of a vfat partition.

On the fstab I have put the entry of that partition (/dev/sda5) to be like this:

/dev/sda5 /mnt/data vfat noauto,user,rw 1 0

so any user that login to the machine then can mount the partition and have the /mnt/data under his/her name and have full read/write access to it.

But problem is sometimes these people forget to unmount the directory after they have finished and logout of the system. And the next guy wouldn't be able to umount or mount the directory again or to write to it.

So one of the solution I can think of is to have a simple script to automatically unmount the partition everytime the user logout. So something like a logout or exit script (a counterpart of the profile script).

Is there such a thing as a logout script in linux ? Or do you have some other solutions for my problems ?

Thanks a million for any help or suggestion
Old 12-30-2006, 12:14 PM   #2
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Debian "Testing"
Posts: 6,117

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
Easier might be to have that partition mounted at boot time, in such a way that all the files are owned by root, but have permissions of 777 (ie anyone can read/write these files).
So try this as your fstab line:
/dev/sda5 /mnt/data vfat iocharset=iso8859-15,codepage=850,umask=0 0 0
then either reboot or do mount -a as root
Old 12-30-2006, 12:18 PM   #3
Senior Member
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
Why don't you mount it automatically at startup and just keep it mounted? If you specify the options gid (to give all files on the mounted partition your users group) and a corresponding umask, it should work for everybody. Here's mine:
/dev/hda3     /mnt/win      vfat     gid=users,umask=002      0  0
Old 12-30-2006, 12:42 PM   #4
Registered: Jul 2003
Posts: 83

Original Poster
Rep: Reputation: 15
You know what.... I learned something new today...

Thanks guys... both suggestions obviously work, but I will stick to one given by uselpa, since it is more secure by not giving the world access to the mounted directory.

Thanks again...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
10.0 RC1 logout out from KDE needs CTRL-Z to exit 1kyle SUSE / openSUSE 0 09-23-2005 05:01 AM
call another script and have the inital script exit mjtice Programming 1 09-11-2005 12:54 PM
Invoke script on xsession exit? comp12345 Linux - Software 1 06-27-2004 11:27 PM
RHL9.0 hangs when logout/exit command line mellsie25 Linux - Newbie 7 10-17-2003 10:30 PM
script 'exit' command kilobravo Linux - General 8 01-16-2003 04:24 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:30 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration