Skip to content

Instantly share code, notes, and snippets.

@vadimstasiev
Last active June 24, 2021 19:15
Show Gist options
  • Select an option

  • Save vadimstasiev/e4224682c40b60350405ae767b9a21fc to your computer and use it in GitHub Desktop.

Select an option

Save vadimstasiev/e4224682c40b60350405ae767b9a21fc to your computer and use it in GitHub Desktop.
Linux mount SMB share with credentials

Linux mount SMB share with credentials

Install cifs utils

sudo apt install cifs-utils

Add the following to /etc/fstab

//10.10.10.20/vadim-media /media/vadim-media/ cifs credentials=/home/srv01/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777

Create the credentials file

nano ~/.smbcredentials

username=msusername
password=mspassword

Change the permissions of the file to prevent unwanted access to your credentials:

sudo chmod 600 ~/.smbcredentials

Check to see if it works

sudo mount -a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment