Linux-Noob Forums
mount different drives for different user - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html)
+--- Forum: How Do I? (https://www.linux-noob.com/forums/forum-60.html)
+--- Thread: mount different drives for different user (/thread-981.html)



mount different drives for different user - viper81 - 2008-04-03


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.




mount different drives for different user - znx - 2008-04-03


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




mount different drives for different user - viper81 - 2008-04-07


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.