Skip to content

Instantly share code, notes, and snippets.

@MuXiu1997
Last active October 26, 2023 05:45
Show Gist options
  • Select an option

  • Save MuXiu1997/76294a07c8727208159e9d74a62d0533 to your computer and use it in GitHub Desktop.

Select an option

Save MuXiu1997/76294a07c8727208159e9d74a62d0533 to your computer and use it in GitHub Desktop.
Linux SMB mount
  1. Make sure dependencies
sudo apt install cifs-utils -y
  1. Create a directory to be mounted
sudo mkdir /mnt/<SHARE>
  1. Create the credential file
sudo vim /.<SHARE>_ecredentials
sudo chmod 400 /.<SHARE>_ecredentials
# /.<SHARE>_ecredentials
username=example_username
password=example_password
  1. mount the SMB share
sudo vim /etc/fstab
# /etc/fstab

# ...

//<SMB_HOST>/<SMB_SHARE> /mnt/<SHARE> cifs vers=3.0,credentials=/.<SHARE>_ecredentials,uid=<UID>,gid=<GID>,forceuid,forcegid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment