Mounting Windows Share Drives at Login in Ubuntu
First make sure that the proper packages are installed:
sudo apt-get -y install libpam-mount smbfs
Then edit the global configuration file to allow for user config files:
sudo gedit /etc/security/pam_mount.conf.xml # Make sure the line with <luserconf is uncommented. # Make sure <mntoptions allow=”*” /> is uncommented. # Turn on debugging: <debug enable="1" />
Now create a file called “$HOME/.pam_mount.conf.xml” for the user, substituting your user ID for myuser and changing various other settings to match your Windows share setup:
gedit ~/.pam_mount.conf.xml
Add this to the file (change user specific elements):
<pam_mount>
<volume
user="*" fstype="smbfs" server="serveraddress.com"
path="folderpath" mountpoint="~/mountpath"
options="nodev,nosuid,iocharset=utf8,noperm,user=myuser,domain=MYDOMAIN"
/>
</pam_mount>
Keep in mind that your Ubuntu user ID does not have to match the Windows login ID (that is specified in the config file), but your Ubuntu password does have to be the same as the password for the Windows login ID.
You will have to log off and back on to test it out. Errors should go to the "/var/log/auth.log" file:
tail -f /var/log/auth.log
Once things are set up you will probably want to turn off debugging or you will see logs of PAM debugging output in odd places:
sudo gedit /etc/security/pam_mount.conf.xml # Turn off debugging: <debug enable="0" />
