本文介紹如何Linux如何開機自動mount Windows cifs共享,可以在server重啓時候自動mount數據,不影響應用程序的數據訪問
- linux安裝cifs驅動
sudo apt-get install cifs-utils
- 創建credentials文件保存用戶密碼。
將文件改爲 600權限.dxi@mylinux:~$ cat .smbcredentials username=dxi password=mypassword
- 在 /etc/fstab 中增加cifs mount
dxi@mylinux:~$ cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> //windows_server_name/datasets /mnt/data/datasets cifs credentials=/home/dxi/.smbcredentials,iocharset=utf8,sec=ntlm 0 0
- 驗證是否mount成功
sudo mount -a