💻 Mounting Samba share on Ubuntu

I’m mainly noting this here for myself, but perhaps someone else will find this information handy.

Install package cifs-utils

sudo apt-get install cifs-utils

Create folder to mount the share into

sudo mkdir /media/Share

Create a file with user credentials in your home directory.

touch ~/.smbcredentials

Edit the smbcredentials file

username=smb_username
password=smb_password

Edit /etc/fstab

sudo nano /etc/fstab

Add the following line (edit where necessary)

//NASIP/shares/ /mnt/nas cifs iocharset=utf8,credentials=/home/USER/.smbcredentials,vers=3.0,iocharset=utf8,rw,sec=ntlmssp,file_mode=0644,dir_mode=0755,uid=1000,gid=1000 0 0

You can now mount the samba share with the command below

sudo mount /mnt/nas/