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. mount -t cifc "windows共享文件夾" "Linux /mnt路徑"

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


    注意:

    Linux中提示:

    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 共享文件夾

    Linux mount 命令掛載 Windows 共享文件夾



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