Linux開機自動mount windows cifs共享

本文介紹如何Linux如何開機自動mount Windows cifs共享,可以在server重啓時候自動mount數據,不影響應用程序的數據訪問

  1. linux安裝cifs驅動
    sudo apt-get install cifs-utils
    
  2. 創建credentials文件保存用戶密碼。
    dxi@mylinux:~$ cat .smbcredentials
    username=dxi
    password=mypassword
    
    將文件改爲 600權限.
  3. 在 /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
    
  4. 驗證是否mount成功
    sudo mount -a
    

參考文獻:
MountWindowsSharesPermanently

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章