[clue-tech] Sharing samba with libpam-mount?

David L. Anselmi anselmi at anselmi.us
Sat Jan 31 17:05:43 MST 2009


OK, I tried this and it Just Worked(tm).  Getting things mounted on 
login this way is pretty cool.

Adrian F. Nagle, IV wrote:
> I'm trying to mount my samba share directory permanently, when booting/logging in and without passwords.
> 
> I have the login and passwords the same on all of my machines.

You have to make sure the client's Unix password (the one you log in 
with) and the server's Samba password are the same.  See passwd(1) and 
smbpasswd(8).

> I downloaded and installed the libpam-mount debian package for my kubuntu installation.
> 
> I added "@include common-pammount" to etc/pam.d/login, su, and kdm (and not the kdm-np).

I did these too, as well as smbfs that you already have.  I also created 
a user on the samba server that matches my local user, with the same 
Unix and smb password.  I only edited the login file since I wasn't 
going to log in and out of KDE.

You can test by going to vt1 (ctrl-alt-F1) and logging in there.  When I 
made the smbpasswd different I got some useful error messages on the 
terminal.  So it might be easier to test that way than with kdm.

> The config file apparently changed to an xml format file. I added the
> following to the bottom of /etc/security/pam_mount.conf.xml:
> 
>     <volume
>             user="*" | pgrp="*" | sgrp="winusers"
>             fstype="smbfs"
>             server="//jerome/srvshare"
>             path="nagle_ext1"
>             mountpoint="/media/nagle_ext1"
>     />
> 
>     <volume
>             users="*"
>             fstype="smbfs"
>             server="//jerome/srvshare"
>             path="homes"
>             mountpoint="/home/%(USER)/remote"
>             options="dmask=0711"
>     />

Here I just used this:

     <volume
             users="*"
             fstype="smbfs"
             server="st-peter"
             path="install"
             mountpoint="/mnt"
     />

server is the name of the server, only.  Use jerome, and make sure that 
"ping jerome" works.

path is the share name on the server.  It will match what your smb.conf 
has in brackets (e.g., in my case [install]).  In your case I think this 
is srvshare.

mountpoint is a local directory where you want to see the files.  It 
should exist, probably.  So you can use /mnt for testing, or something 
under /media, or make something in your home directory.  I'm pretty sure 
that root is used to do the mount.

In my case I got all the files I expected under /mnt.  The permissions 
match what's on the server but the user and group are both me.  Probably 
there are options to change that (but you'd want the uids/gids to match 
between the server and all clients).

If you don't get useful messages when logging in to a terminal you might 
also set the <debug enable="0" /> line in pam_mount.conf.xml to 1.

Dave


More information about the clue-tech mailing list