PAM mount : Monter des partages réseaux au login

From / Bloc Notes Informatique
Jump to: navigation, search

1 Introduction

You may need sometime to mount automatically some network shares. It could be done with the pam_mount module.

2 Installation

For installation :

Command apt-get
apt-get install pam_mount

3 Configuration

3.1 pam_mount.conf

Edit the /etc/security/pam_mount.conf file and configure what you need. Here we would like users to have nfs home share to be mounted from the server at logon. Add this line at the end of the file :

Configuration File /etc/security/pam_mount.conf
volume * nfs my_nfs_server /home/& ~ - - -

You may also need to have other mount points for other things like smb, cifs or fuse :

Configuration File /etc/security/pam_mount.conf
volume user smbfs krueger public /home/user/krueger - - -
volume * fuse - "sshfs#&@fileserver:" /home/& - - -

3.2 Application

You must choose an application to mount automatically your share. For example I choose SSH. When a user logs into SSH it must mount the NFS share, so edit this file :

Configuration File /etc/pam.d/ssh
auth       required envfile=/etc/default/locale
auth       required
@include   common-auth
@include   common-account
session    required
@include   common-session

Now when you'll login, it will automatically mount your home.