O arquivo de configuração do libpam-mount fica localizado no diretório
/etc/security/pam_mount.conf, porém ele não é muito intuitivo. Então, a
seguir você poderá ver uma versão resumida do arquivo.
# Ative esta opção caso você queira depurar sua configuração e acompanhar
# a seqüencia de montagem dos seus volumes.
# Esta configuração pode ser sobreposta pela configuração de usuário.
# Format: debug [ 1 | 0 ]
debug 0
mkmountpoint 1
fsckloop /dev/loop7
options_allow *
options_deny nodev
lsof /usr/sbin/lsof %(MNTPT)
fsck /sbin/fsck -p %(FSCKTARGET)
losetup /sbin/losetup -p0 "%(before=\"-e\" CIPHER)" "%(before=\"-k\" KEYBITS)" %(FSCKLOOP) %(VOLUME)
unlosetup /sbin/losetup -d %(FSCKLOOP)
cifsmount /bin/mount -t cifs //%(SERVER)/%(VOLUME) %(MNTPT) -o "username=%(USER)%(before=\",\" OPTIONS)"
smbmount /usr/bin/smbmount //%(SERVER)/%(VOLUME) %(MNTPT) -o "username=%(USER)%(before=\",\" OPTIONS)"
ncpmount /usr/bin/ncpmount %(SERVER)/%(USER) %(MNTPT) -o "pass-fd=0,volume=%(VOLUME)%(before=\",\" OPTIONS)"
smbumount /usr/bin/smbumount %(MNTPT)
ncpumount /usr/bin/ncpumount %(MNTPT)
umount /bin/umount %(MNTPT)
lclmount /bin/mount -p0 %(VOLUME) %(MNTPT) "%(before=\"-o\" OPTIONS)"
cryptmount /bin/mount -t crypt "%(before=\"-o\" OPTIONS)" %(VOLUME) %(MNTPT)
nfsmount /bin/mount %(SERVER):%(VOLUME) %(MNTPT) "%(before=\"-o\" OPTIONS)"
mntagain /bin/mount --bind %(PREVMNTPT) %(MNTPT)
pmvarrun /usr/sbin/pmvarrun -u %(USER) -d -o %(OPERATION)
#Configuração dos volumes que deverão ser montados automaticamente
volume * smb servidor homes /home/&/remote uid=&,gid=&,dmask=750 - -
volume * smb servidor share1 /home/&/share1 uid=&,gid=&,dmask=770 - -
volume * smb servidor share2 /home/&/share2 uid=&,gid=&,dmask=770 - -
Agora precisamos configurar o login propriamente dito, então é
necessário editar as configurações do PAM. No Debian tais configurações
encontram-se no diretório /etc/pam.d.
Arquivo common-auth.conf:
#
# /etc/pam.d/common-auth - authentication settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authentication modules that define
# the central authentication scheme for use on the system
# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the
# traditional Unix authentication mechanisms.
#
auth required pam_unix.so nullok_secure
auth optional pam_mount.so use_first_pass
Arquivo common-session.conf:
#
# /etc/pam.d/common-session - session-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define tasks to be performed
# at the start and end of sessions of *any* kind (both interactive and
# non-interactive). The default is pam_unix.
#
session required pam_unix.so
session optional pam_mount.so
Feitas estas configurações, seu sistema estará pronto para efetuar a montagem automática de volumes.