Ask Your Question

Revision history [back]

automount SMB share using pam_mount

Hello,

I am on Fedora 29 with KDE.

I am trying to mount a FreeNAS SMB share with pam_mount. I followed the following example for pam_mount use but adapted it with my SMB share.

I successfully mounted the share manuallyusing sudo mount -t cifs before trying this.

  • I installed pam_mount using dnf install pam_mount.

  • Like in the example, I added auth optional pam_mount.so and and session optional pam_mount.so lines to /etc/pam.d/sshd after other auth and session entries.

  • I created the /media/share directory.

Then, I added the following just before the </pam_mount> in etc/security/pam_mount.conf.xml:

<volume options="uid=%(USER),gid=100,dmask=0700" user="*" mountpoint="/media/share" path="share" server="192.168.1.10" fstype="cifs" />

But, on Fedora start, nothing is mounted in /media/share and I don't understand the cause.

Thanks in advance.

automount SMB share using pam_mount

Hello,

EDIT: I am finally found the following solution.

This explain how to automount a SMB share (From a FreeNAS 11 server) on Fedora 29 with KDE.

I am trying to mount a FreeNAS SMB share with pam_mount. I followed the following example for pam_mount use but adapted it with my SMB share.

I successfully mounted the share manuallyusing on user login.

1: Install pam mount

sudo mount -t cifs before trying this.

  • I installed pam_mount using dnf install pam_mount.

  • Like in the example, I added pam_mount

2: Edit pam mount configuration file:

Open the following file:

sudo nano /etc/security/pam_mount.conf.xml

Then add share information before </pam_mount>:

<volume 
    mountpoint="~/share_name"
    path="share_name"
    server="server_adress"
    fstype="cifs"
    user="*"
/>

3: Enable pam mount

Open the following file:

sudo nano /etc/pam.d/password-auth

Add at the beginning:

auth        required                                     pam_mount.so

Add at the end:

session     optional pam_mount.so and and  session optional pam_mount.so lines to /etc/pam.d/sshd after other auth and session entries.

  • I created the /media/share directory.

  • Then, I added the following just before the </pam_mount> in etc/security/pam_mount.conf.xml:

    <volume options="uid=%(USER),gid=100,dmask=0700" user="*" mountpoint="/media/share" path="share" server="192.168.1.10" fstype="cifs" />
    

    But, on Fedora start, nothing is mounted in /media/share and I don't understand the cause.

    Thanks in advance.

    pam_mount.so