一、準備Windows的共享目錄
目前創(chuàng)新互聯(lián)已為近1000家的企業(yè)提供了網站建設、域名、虛擬主機、網站改版維護、企業(yè)網站設計、撫州網站維護等服務,公司將堅持客戶導向、應用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。
建立一個文件夾啟用匿名訪問,在Linux掛載的時候輸入密碼的時候可以隨便輸入。
二、掛載目錄到Linux系統(tǒng)
mount -t cifc "windows共享文件夾的路徑" "linux /mnt路徑"
例如
mkdir /windows
mount -t cifs //192.168.1.10/linuxshare /windows
Linux 會要求輸入訪問Windows 共享文件夾上的密碼。
下面是根據用戶權限設置的共享文件夾
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.
說明遠程共享文件夾路徑不存在。請仔細檢查,并更正目錄路徑。
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共享目錄的用戶名和密碼直接加入到命令中。
3
mount -t cifs -o username=WindowsLogin,password="passwordinWindows"
//16.187.190.50/test /mnt/
注意:該命令中,username為windows上的用戶;password為window用戶對應的密碼
4
步驟3的命令也可以使用以下方式實現(xiàn):
mount.cifs -o username="Administrator",password="PasswordForWindows" //16.187.190.50/test /mnt/
5
通過步驟3和步驟4可以成功將windows共享文件夾掛載在/mnt目錄下。不過由于mount命令只能由root權限用戶使用。其掛載文件夾的默認owner和group都為root,并且不能通過chmod命令更改權限。
6
使用mount命令,給掛載共享文件夾指定owner和group.
mount.cifs -o username="Administrator",password="PasswordForWindows",uid=Mysa,gid=Mysa //16.187.190.50/test /mnt/
7
檢查/mnt/中文件夾的owner和group。
8
更改文件夾權限。給mount共享文件夾所在組的寫權限。
mount.cifs -o username="Administrator",password="PasswordForWindows",Mysa,gid=Mysa,dir_mode=0777 //16.187.190.50/test /mnt/