Mount Microsoft Share at login

I have an Open Suse 11 box that I am running as a multiple user server. All users will access this box via ssh. All users are logging in using the Microsoft Active Directory domain userid and password with no problem. I also have a MS Windows Server running as a fileserver and want each of the individual users to be able to mount their shared directory at login and unmount it at logout.

I understand that mount is not available to non root users for security reasons, but if a non root user logs in on the console, they can easily access their shared space using by using “Connect to server” in Nautilus.

The thing that I don’t understand is why users cannot do this via the command line, but can via Nautilus. It seems that eventually Nautilus is running some command that should be available from the command line so that the shared space can be mounted without root access.

Any insight would be appreciated. I feel like I might be missing something very simple here as this seems like a common thing to need to do in a multi-user environment.

Thanks,

Steve

i’m going to annoy you and ask you to take a little read here lol

Samba: HowTo Mount a CIFS Network Share [AKA Map Network Drive] in openSUSE

it’s all explained in there, you will simply need to edit fstab, it’s not that hard.

hope this helps,

Ross.

that was not exacly the question thestig… Although a good read :wink:

Steve,
Haven’t looked at this but I suspect Nautilus has permissions to execute a mount though GNOME’s gvfs.
Another difference is that the mount point is made in the home folders, so no extra rights are needed on the mount point itself.

Curious now too,
Wj

Magic31 wrote:

>
> that was not exacly the question thestig… Although a good read :wink:
>
> Steve,
> Haven’t looked at this but I suspect Nautilus has permissions to
> execute a mount though GNOME’s gvfs.
> Another difference is that the mount point is made in the home folders,
> so no extra rights are needed on the mount point itself.
>
> Curious now too,
> Wj
>
>

Likely using the FUSE user filesystem. Using FUSEfs, you can mount drives in
your own subdirectories without asking root for help.

-switch-topic-

If you want a user to be able to mount/umount something listed in /etc/fstab,
place the ‘user’ or ‘users’ option at the end of the options declaration
(4th ‘column’) on the line in fstab describing the mount.

‘user’ - only the user who mounted a filesystem can unmount it
‘users’ - anyone can unmount it


L R Nix
lornix@lornix.com

Yeah, I had read the docs mentioned above already.

Looks like FUSEfs will work. I certainly do only want the user to mount their shared space in their home directory when they login and then unmount it when loging out. They would be mounting something like //vault/home/username to a subdirectory of their home.

I hoped to be able to script this in the login/logout scripts for the entire system.

Sound doable?

Thanks,

Steve

plemdog wrote:

>
> Yeah, I had read the docs mentioned above already.
>
> Looks like FUSEfs will work. I certainly do only want the user to
> mount their shared space in their home directory when they login and
> then unmount it when loging out. They would be mounting something like
> //vault/home/username to a subdirectory of their home.
>
> I hoped to be able to script this in the login/logout scripts for the
> entire system.
>
> Sound doable?
>
> Thanks,
>
> Steve
>
>

Definitely doable!

{Sigh} NOW I’ve got to read up on the fusefs stuff… oh joy! :slight_smile:

if you were to put some commands into a user’s .xinitrc, you could have a
user’s shared folder automounted into their home directory… something like
this:

(forgive the pigeon code, rusty on fusefs, but have concept in my head)

make sure mount point exists

if ! -d ~/shared ]; then
mkdir ~/shared
fi
fusemount smb://username:password@host/folder ~/shared

Of course, now I can’t remember how to get something to occur when a user logs
out…

the man page for xinit is informative, it says that when the xinitrc script
exits, the user has logged out. The script does some setup, runs the window
manager (kde/gnome/tvm/etc), and then exits. The window manager doesn’t
return until the user logs out… so:

sample .xinitrc script

do various setup tasks

mount user’s shared folder

fusemount smb:… ~/shared

run window manager

do_win_manager

umount the share

fuseumount ~/shared

exit 0

Or something like that {Jedi hand waving motion}

Loni


L R Nix
lornix@lornix.com

pam_mount exists for that purpose.

jengelh wrote:

>
> pam_mount exists for that purpose.
>
>

Thank you! That helps quite a bit. I forget about the pam subsystem that
exists, and that can do all sorts of amazing things, but I haven’t read
enough about yet…

The phrase

The more I learn, the more I learn, there’s more to learn.

keeps looping in my head.


L R Nix
lornix@lornix.com

Thanks guys, this is all really helpful. The only problem is that I can’t find fusemount. I’ve installed all the fuse packages that I can find and do not have it.

Would you care to explain how to use pam to do this too?

Thanks,

Steve

The more I learn, the more I realize I know only a small part of it all - is the one that boggles me :slight_smile:

The command should be fusermount (note the r)

A good place to start could be here : FUSEWiki - FAQ

Good luck & let us know what you learn :slight_smile:

Cheers,
Wj

You do not need FUSE to mount SMB/CIFS via pam_mount.

A little HOWTO or pointer might be in order :wink:

Cheers,
Wj

jengelh,

I found this page: Kroon Information Systems CC: Howto: CIFS + pam_mount

Does this look like it will work? It seems like it should be simpler than that, but just thought I would ask before I started editing files.

Thanks,

Steve

OK, now I see that there is a pam_cifs which is supposed to be simpler to use than pam_mount. I just can’t find any docs on how to configure pam_cifs. Any ideas?

Thanks,

Steve

pam_cifs looks redundant to me.

The page from Kroon is a bit outdated, as the pam_mount configuration file moved to XML. It’s now <volume fstype=“cifs” server=“name” path=“homes” mountpoint="~" />