Pam mount

The PAM module allows systems to automatically mount file systems when a user logs on, and unmount file systems when the user logs off.

USE flags
The package has a few USE flags that it supports:

Emerge
To install the package, just emerge it:

Configuration
No specific configuration is needed for the installation itself. The actual configuration entries are mentioned below under the [#Usage|Usage] section.

Mounting regular file systems
Edit the PAM configuration file in which the mount action has to be configured. Add the required call to for   and   as shown in the next example:

Next, edit or create the following configuration file:

This file will establish the file systems to mount when a particular user logs on. Of course, replace the example values with actual ones.

Mounting LUKS encrypted file systems
One might want to mount devices encrypted with cryptsetup. Edit the PAM configuration file of choice (such as ) and add calls to  in the   and   sections:

The first one opens the encrypted device located in and maps it to.

The second one calls a script for closing the encrypted device on logout. It may look like this:

Do not forget to use the proper map (the one defined in.

Unmerge
Before removing the package, make sure that no PAM configuration file refers to the module anymore:

If no file refers to it anymore, then the package is safe to unmerge: