HOWTO: Automount for sambashares on Ubuntuclients

Automount for sambashares on Ubuntuclients

With the pamm-module “pam-mount” drives such as NFS, Samba and more are automatically included in the login and unmounted during logout. Very nice thing. It does not matter how you sign up. Whether graphically or CMD or via SSH … For this you have to install only some packages:

Installation

apt install libpam-mount davfs2 -y

Configuration

Then edit the file “/ etc / security / pam_mount.conf.xml”. Important are the drives that you want to include. The example describes “CIFS” and “WEBDAV” .

pam_mount.conf.xml

<volume fstype="cifs" server="storage.tux.com" options="vers=3.0" path="bilderdatenbank" mountpoint="~/bilderdatenbank"> <not><user>root</user></not> <not><user>sddm</user></not> </volume>
<volume fstype="cifs" server="storage.tux.com" options="vers=3.0" path="dokumente-firma" mountpoint="~/dokumente-firma"> <not><user>root</user></not> <not><user>sddm</user></not> </volume>
<volume fstype="davfs" path="https://daten.tux.com/webdav-daten" mountpoint="~/webdav-daten" options="username=%(USER),rw,nosuid,nodev,uid=%(USER)"> <not><user>root</user></not> <not><user>sddm</user></not> </volume>
..

The file has been implemented for KDE-NEON. For this reason, the user sddm is ignored. For Ubuntu clients, this can be omitted. If one also uses NX (Nomachine), the use, despite its exclude, is no longer functional. It is probably a possible bug.

The big advantage: Specification of password and user are of course not necessary. That’s what PAM cares about. LDAP / Kerberos from UCS does the rest during the login process.

1 Like