Permanently Mapping a Windows Share on Linux

Every few years, I have to set up a fresh Linux box, and I typically want to connect them to some Windows file shares.  There are many resources on how to do this, but many describe approaches which are incomplete, insecure, or not permanent (across reboots).  Here is what has worked for me.

Note: The approach I describe comes from https://wiki.ubuntu.com/MountWindowsSharesPermanently.  I repeat it here because it gets buried in the search results (and I add a few details they gloss over & tweak a few things).  It is worth reading that as well.

 

Run these commands in order from the console.  

Note: The two "nano" commands open a file editor. I have included the necessary file contents below. After updating/creating each of the files, save & exit the editor, and continue with these commands.

sudo apt install cifs-utils
sudo su
cd /root
nano .cifscredentials
chmod 600 .cifscredentials
exit
sudo nano /etc/fstab
sudo mount -a
view raw Instructions hosted with ❤ by GitHub
username=myusername
password=mysupersecretpassword
#Leave existing content
//yourshareurl/foldername /mnt/yourlocalfolder cifs defaults,credentials=/root/.cifscredentials,vers=1.0 0 0
#repeat this line for additional shares
view raw fstab hosted with ❤ by GitHub

You should now be able to browse to the local folders you entered in fstab and view the shares.

Comments

Popular posts from this blog

Fixing Conan Lock Issues

Initialize With Care

Dude, Where's My Framework?