I have configured my Ubuntu system to mount a cifs share using pam_mount and a credentials file (the credentials to access the cifs share are different to those I use on my Linux machine). I'd like to avoid having my password stored in plain text.

My setup is as follows: I enabled the following line in /etc/security/pam_mount.conf.xml:

<luserconf name=".pam_mount.conf.xml" />

I added cred and dir_mode to the allowed mntoptions:

<mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other,cred,dir_mode" />

I've created a ~/.smbcredentials file with the following contents and given it 0600 permissions:


I've created a ~/.pam_mount.conf.xml file containing the cifs share I want to mount:

<?xml version="1.0" encoding="utf-8" ?>

<volume fstype="cifs" server="<MY_WIN_SERVER>" path="<MY_WIN_SERVER_SHARE>/<MY_WIN_SERVER_SHARE_SUBDIR>" mountpoint="/home/%(USER)/<MY_WIN_SERVER>" options="cred=/home/%(USER)/.smbcredentials,nosuid,nodev,dir_mode=0700" />


The above all works nicely. However, I don't like having my password stored in plain text. Is there a way to get some sort of password prompt instead?

  • An encrypted volume is not an option? – Hauke Laging Dec 18 '14 at 2:45
  • An encrypted volume might be an option - can you tell me a bit more about it or how it would work? – Nathan S. Watson-Haigh Dec 18 '14 at 4:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.