Mount SMB Shares in Ubuntu Linux

Mounting smb shares with no credentials
- Install require packate:
sudo apt install cifs-utils
- Create folder to mount
sudo mkdir /media/plex
- Mount smb share with non-credential access:
sudo mount -t cifs -o rw,vers=3.0,guest //192.168.1.5/share /media/plex
- Remount on system reboot
sudo vi /etc/fstab
Enter below value at the end of the line:
//192.168.1.5/share /media/plex cifs username=guest,password=,nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=1 0 0
Mounting smb shares with credentials
Follow step 1 and 2 from above.
- Create credential file
vi /root/.mysmbcreds
Enter values as shown in below example:
username=johnsmith
password=mysupersecretpassword
- Mount smb share with credentials:
sudo mount -t cifs -o rw,vers=3.0,credentials=/root/.mysmbcreds //192.168.1.5/share /media/plex
- Remount on system reboot
sudo vi /etc/fstab
Enter below value at the end of the line:
//192.168.1.5/share /media/plex cifs credentials=/root/.mysmbcreds,nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=1 0 0