Linux 開機自動掛載NAS的SMB資料夾
本教學以debian系統為主
NAS使用OpenMediaVault
English Version
NAS設置
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
共有三個smb資料夾,︁分別是設定NAS SMB資料夾
git clone https://github.com/frakw/nas_smb_mounter.git
修改nas.conf
,︁存放NAS的基本資訊
NAS_IP=NAS的IP
MOUNT_POINT=/mnt
NAS_NAME=NAS的名字
NAS_SMB_1=NAS的第1個SMB資料夾名稱
NAS_SMB_2=NAS的第2個SMB資料夾名稱
NAS_SMB_3=NAS的第3個SMB資料夾名稱
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
修改.smbcredentials
,︁存放NAS的帳號密碼
username=NAS的使用者名稱
password=NAS的使用者密碼
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
測試掛載
設定.smbcredentials
的權限
sudo chmod 600 .smbcredentials
安裝必要套件
sudo apt install cifs-utils
設定腳本為可執行文件
sudo chmod +x mount.sh
sudo chmod +x unmount.sh
執行掛載
成功看到資料夾內容
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
解除掛載開機自動進行掛載
在最底下加入
@reboot sleep 30 && <mount.sh的位置>
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
會加入sleep 30
是因為我透過Tailscale來與NAS連線,︁所以等待Tailscale啟動後再執行