Ubuntu: Mount Windows-Share on startup

Install cifs-utils
sudo apt update
sudo apt install cifs-utils
Create directory to use as mount point for the Windows share
sudo mkdir /mnt/winshare
Mount Windows share manually using terminal
sudo mount -t cifs //servername/share /mnt/winshare -o username=shareuser,vers=3.0

If supported use Version 3.0. Otherwise use a supported version (For example: vers=2.0)

Mount Windows share on startup using /etc/fstab

Create file with credentials
sudo nano /etc/cifs-cred
username=shareuser
password=password
Set correct permissions so that no unauthorized user can read the file
sudo chown root /etc/cifs-cred
sudo chmod 400 /etc/cifs-cred
Add record to /etc/fstab by using nano
sudo nano /etc/fstab
//servername/share /mnt/winshare     cifs     credentials=/etc/cifs-cred,file_mode=0777,dir_mode=0777,vers=3.0     0    0
Test it
sudo mount /mnt/winshare
How to unmount
sudo umount /mnt/winshare

Now reboot and check if share gets mounted automatically

Leave a Reply

Your email address will not be published. Required fields are marked *