Permanently Mount Network Share
Original Post:

The steps below have the mount points in the ‘/media/‘ folder, this follows what was recommended on some source webpages. When I started to solve this problem my mount points were setup in the ‘/mnt/‘ folder, as of now I am not sure if that will still work. You could give it a try if that’s what you want.
Sources:



After new Ubuntu install, additional packages to add:
samba-common, samba, smbclient
Open ‘Terminal’ and enter the following commands:
Install cifs utilities
sudo apt-get install cifs-utilsCreate mount points for windows shares and set permissions
sudo mkdir /media/mountNamesudo chown userId:userId /media/mountNamesudo chmod 755 /media/mountNameCreate ‘credentials’ file to hold userid/password and set permissions
sudo nano ~/.smbcredentialsEnter the following 2 lines
username=windowsLoginId
password=windowsPasswordenter 'ctrl-x', then 'y' and finally 'enter' to exit and save file
Set permissions to hide username and password
sudo chmod 600 ~/.smbcredentialsRetrieve ‘uid’ and ‘gid’ values for next step
idthe ‘id’ command will output something similar to the following:
uid=1000(userId) gid=1000(userId) groups=1000(userId),4(adm),………….,1001(smbgroup)Backup and edit ‘fstab’ to mount window share at ubuntu startup
mkdir ~/system-backupscp /etc/fstab ~/system-backupssudo nano /etc/fstabat end of file enter the following line:
//winServerName/shareName /media/mountName cifs credentials=/home/userId/.smbcredentials,uid=1000,gid=1000,vers=3.0,nounix 0 0If your share contains spaces, instead of the spaces, input:
\040For example:
//winServerName/My\040Shared\040Driveenter 'ctrl-x', then 'y' and finally 'enter' to exit and save file
Test mounting of windows network share
sudo mount -aif no errors appear, the mount should appear in ‘file manager’
check mount in file manager for read/write access
Test permanent network share
shutdown and reboot pc
open ‘file manager’ and check network share
Other relevant commands
manually mount network share
sudo mount -t cifs -o username=windowsLoginId //winServerName/shareName /media/mountNameyou will be prompted for the ‘password’
prepare mount point for deletion; do not run command where ‘pwd’ is ‘/media’
sudo umount /media/mountNamedelete mount point
rmdir /media/mountName
