LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   logout/exit script ?? (https://www.linuxquestions.org/questions/linux-software-2/logout-exit-script-514881/)

aherrys 12-30-2006 11:03 AM

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

tredegar 12-30-2006 11:14 AM

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

uselpa 12-30-2006 11:18 AM

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:
Code:

/dev/hda3    /mnt/win      vfat    gid=users,umask=002      0  0

aherrys 12-30-2006 11:42 AM

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...


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