Mount Protected Network Shares Securely (no password prompts)

  10 years ago

Adapted from Mount Windows Shares Permanently

I use Windows Home Server (WHS) which uses CIFS access by default. Linux Mint allows you to access shares easily from nautilus automagically. When it comes to apps like VLC trying to play files from those mounted points, it won't work. Here is the solution:

Install the filesystem

sudo apt-get install smbfs

Create mount folder

mkdir /media/mountname


nano /etc/fstab

Add the following in fstab for read/write permission:

//serverip/mountname  /media/mountname  cifs defaults,uid=1000,gid=1000,credentials=/home/username/.smbcredentials,umask=777  0  0

(Copy above from top to bottom into your notepad, it's all there this site just won't show it.)

Correct serverip,mountname,username to yours

Create a file that fstab will reference for the network shares username/password

nano /home/username/.smbcredentials

Enter in:


save it 'Ctrl+x' press 'y' then enter

Change permissions on .smbcredentials so only you have permission to read and write to it.

chmod 600 .smbcredentials

Finally mount it all as root

mount -a

Fixing a CIFS bug with Network Manager

If you use network manager, and are getting really slow shutdowns. It's probably because the network manager shuts down before unmounting the network shares. That will cause CIFS to hang, and wait for 60 seconds or so. Here's what you do to fix it:

sudo ln -s /etc/init.d/ /etc/rc0.d/
sudo ln -s /etc/init.d/ /etc/rc6.d/

acewolk 7 years ago

Awesome, thanks. May need to use:

sudo apt-get install cifs-utils

instead of:

sudo apt-get install smbfs

remoulder 10 years ago

@Clem: There seems to be clipping on the RHS of the fstab line when displaying this under FF 3.6.8. The line is truncated after the 'l' in credentials by the border.