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 |
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 |
Comments
Post a Comment