Linux-Noob Forums

Full Version: mount different drives for different user
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hi everyone,

 

I have a question I hope you can help.

 

I have 2 PCs, 1 running Windows and the other running SuSe Linux 9. Both PCs are connected through a LAN. I have different users using the Linux and I would like to mount their respective drives (located in the Windows PC) whenever they log on. This means that when user1 logs in, his drives will be mounted. The drives will be unmounted once he logs off. The mounting and un-mounting should be done automatically.

 

May I know how I can achieve this? Many thanks in advance.


Quick and dirty, add a mount command into ~/.bashrc and a umount command into ~/.bash_logout. But that is a horrid method!

 

Automount could manage mounting "on-the-fly" meaning that when you enter a particular directory it would mount it then, after a preset idle timeout, it would umount it.

 

The *best* way would be to make PAM do it for you with the "pam_mount" module but it can be a bit tricky (or at least it was when I tried to make it work once before).


Quote:Quick and dirty, add a mount command into ~/.bashrc and a umount command into ~/.bash_logout. But that is a horrid method! 

Automount could manage mounting "on-the-fly" meaning that when you enter a particular directory it would mount it then, after a preset idle timeout, it would umount it.

 

The *best* way would be to make PAM do it for you with the "pam_mount" module but it can be a bit tricky (or at least it was when I tried to make it work once before).
 

 

Thanks for your reply.. I will give it a try.