天天看點

Linux mount 指令挂載 Windows 共享檔案夾

轉載:http://jingyan.baidu.com/article/b7001fe1694b800e7282dde4.html

在Linux下使用mount指令挂載Windows 上的共享檔案夾。本經驗使用Redhat Linux6.5和windows2012作為實踐平台

工具/原料

  • Windows作業系統上建立共享檔案夾
  • Linux作業系統。

方法/步驟

  1. mount -t cifc "windows共享檔案夾" "Linux /mnt路徑"

    i.e. mount -t cifs //16.187.190.60/test /mnt/

    Linux 會要求輸入通路Windows 共享檔案夾上的密碼。

    注意:

    Linux中提示:

    Unable to find suitable address. 

    說明遠端共享檔案夾路徑不存在。請仔細檢查,并更正目錄路徑。

    Linux mount 指令挂載 Windows 共享檔案夾
  2. i.e. mount -t cifs //16.187.190.50/test /mnt/

    mount error(13): Permission denied

    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

    解決方案:将通路Windows共享目錄的使用者名和密碼直接加入到指令中。

    Linux mount 指令挂載 Windows 共享檔案夾
  3. mount -t cifs -o username=WindowsLogin,password="passwordinWindows"

     //16.187.190.50/test /mnt/

    注意:該指令中,username為windows上的使用者;password為window使用者對應的密碼

    Linux mount 指令挂載 Windows 共享檔案夾
  4. 步驟3的指令也可以使用以下方式實作:

    mount.cifs -o username="Administrator",password="PasswordForWindows" //16.187.190.50/test /mnt/

    Linux mount 指令挂載 Windows 共享檔案夾
  5. 通過步驟3和步驟4可以成功将windows共享檔案夾挂載在/mnt目錄下。不過由于mount指令隻能由root權限使用者使用。其挂載檔案夾的預設owner和group都為root,并且不能通過chmod指令更改權限。
    Linux mount 指令挂載 Windows 共享檔案夾
  6. 使用mount指令,給挂載共享檔案夾指定owner和group.

    mount.cifs -o username="Administrator",password="PasswordForWindows",uid=Mysa,gid=Mysa //16.187.190.50/test /mnt/

    Linux mount 指令挂載 Windows 共享檔案夾
  7. 檢查/mnt/中檔案夾的owner和group。
    Linux mount 指令挂載 Windows 共享檔案夾
  8. 更改檔案夾權限。給mount共享檔案夾所在組的寫權限。

    mount.cifs -o username="Administrator",password="PasswordForWindows",Mysa,gid=Mysa,dir_mode=0777 //16.187.190.50/test /mnt/

    Linux mount 指令挂載 Windows 共享檔案夾