Mount SMB Share in fstab Ubuntu
Username/Password in connect string
- Edit /etc/fstab:
vi /etc/fstab
- Enter the following:
#theShare
//theServer/theShare /mnt/theMount cifs vers=3.0,username=theUsername,password=thePassword,uid=1000,gid=104,iocharset=utf8,file_mode=0777,dir_mode=0777,nounix 0 0
Username/Password in credentials file
- Create a credentials file to a directory of your choice:
vi /home/username/.smbcredentials
- Enter the following entries and adjust the username, passwore and/or domain to your environment:
#username=MyUsername
#password=MyPassword
# OR:
username=MyUsername
password=MyPassword
domain=MYDOMAIN
- Save and set the permissions to the .smbcredentials file to 660:
chmod 660 /home/username/.smbcredentials
- Edit /etc/fstab:
vi /etc/fstab
- Enter the following:
#theShare
//theServer/theShare /mnt/theMount cifs vers=3.0,credentials=/home/username/.smbcredentials,uid=1000,gid=104,iocharset=utf8,file_mode=0777,dir_mode=0777,nounix 0 0