Persistently Mount a SAMBA/CIFS Share in Linux
#Linux #Samba #CIFS #SMB
Full steps can be found at https://i12bretro.github.io/tutorials/0683.html
01. Log into the Linux device
02. Run the following commands in terminal:
# update software repositories
sudo apt update
# install cifs utilities
sudo apt install cifs-utils -y
# create a hidden smb credentials file
nano ~/.myshare.smb
03. Paste the following into the .smb, updating the credentials as needed to authenticate to the share
user=LinuxShare
password=SomethingSecure!!
domain=i12bretro.local
04. Press CTRL+O, Enter, CTRL+X to write the changes
05. Continue with the following commands in the terminal
# create a folder in /media to mount the share
sudo mkdir /media/myshare -p
# edit the fstab file
sudo nano /etc/fstab
06. Add a line to the bottom of fstab with the following, updating the server, share and host file location as needed
NOTE: fstab entries are formatted as //≪%server%≫/≪%share%≫ ≪%mount location%≫ ≪%filesystem type%≫ ≪%mount options%≫
# windows share on i12bretrodc
//i12bretrodc/myshare /media/myshare cifs uid=0,credentials=/home/i12bretro/.myshare.smb,iocharset=utf8,vers=3.0,noperm 0 0
07. Press CTRL+O, Enter, CTRL+X to write the changes
08. Continue with the following commands in the terminal
# remount filesystems listed in fstab
sudo mount -a
# change directory to the share mount point
cd /media/myshare
# reboot to test the share is mounted on started
sudo reboot now
Documentation: https://man7.org/linux/man-pages/man8/mount.8.html
### Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro