Mounting Windows Shares

owensdj

Golden Member
Jul 14, 2000
1,711
6
81
I need to auto-mount a file share from a Windows machine in Lubuntu 14.04. This is a workgroup, not a domain. I looked at this guide:

https://wiki.ubuntu.com/MountWindowsSharesPermanently

and was able to get it to work by just adding the line in fstab. I'd rather use libpam_mount so I won't have to put the user name and password in a text file and it'll work when any user logs in. I did what the guide said, but it's not working. Any ideas?
 

Demo24

Diamond Member
Aug 5, 2004
8,356
9
81
If you use the 'auto' command in fstab command it will mount on boot, and mount regardless of user. What is not working exactly?

Libpam might be more useful if users need to mount different shares.
 

owensdj

Golden Member
Jul 14, 2000
1,711
6
81
Demo, thanks for the reply. I got it to mount putting a command in fstab and putting the username and password on the Windows share in a credentials file. That works, but I wish I could get it working with the Linux log on username and password like in the section on libpam_mount in that guide. That would allow it to work even when the username and password changes without having to edit the credentials file.

I'm not sure how using 'auto' in the fstab command would let it mount regardless of user. What I'm using in fstab now looks like:

//servername/sharename /media/windowsshare cifs credentials=/home/ubuntuusername/.smbcredentials,iocharset=utf8,sec=ntlm 0 0
 
Last edited:

Demo24

Diamond Member
Aug 5, 2004
8,356
9
81
Sorry for the late reply, been really busy.

This is what mine looks like, probably some unnecessary bits in there but it 'works'.

//windowsserver/share /usr/local/data/'folder' cifs credentials=/home/'user'/.smbcredentials,dir_mode=0777,rw,auto,uid=1000,gid=1000,user 0 0

This mounts the share on startup. Not sure if that's what you are looking for or not.
 

owensdj

Golden Member
Jul 14, 2000
1,711
6
81
Demo24 thanks for the reply. I also have it working that way. I was hoping to find a way to make it work without having to put the username and password into the credentials file. That guide has a section on doing it like that using libpam_mount, but I couldn't get it to work.