標籤:linux訪問windows共用
Linux訪問Windows共用有兩種方法:
方法一:mount掛載
建立一個掛載點:
[[email protected] mnt]# mkdir /mnt/myshare
掛載:
[[email protected] mnt]# mount -t cifs -o username=lee //192.168.8.1/Share /mnt/myshare/
幾個參數的具體含義:
cifs:Common Internet File System,#可以理解為網路檔案系統。usrname:#訪問共用資料夾的使用者名稱password:#訪問密碼(我這裡並沒有明文輸入)//192.168.66.198/share:#表示網路檔案夾的地址,注意這裡最後不能加/,如果是//192.168.66.198/share/則會報如下錯誤:mount: //192.168.66.198/share/ is not a valid block device
開機自動掛載:
[[email protected] mnt]# vim /etc/fstab //192.168.8.1/Share /mnt/myshare cifs defaults,username=lee,password=******* 0 2[[email protected] mnt]# mount -a
方法二:samba-client
先查看下有沒有安裝Sambaclient
[[email protected] myshare]# rpm -qa | grep samba
沒有的話安裝Samba用戶端:
[[email protected] myshare]# yum install samba-client
查看windows共用資料夾:
[[email protected] myshare]# smbclient -U lee -L //192.168.8.1
操作windows共用資料夾:
[[email protected] myshare]# smbclient -U lee //192.168.8.1/ShareEnter lee‘s password: Domain=[DANNYLEE] OS=[Windows 10 Enterprise 10240] Server=[Windows 10 Enterprise 6.3]smb: \> #表示進入sambaclient的內部命令:smb: \> help #查看smb可用命令smb: \> help get #查看具體命令使用方法HELP get:<remote name> [local name] get a filesmb: \>ls #查看共用資料夾中的檔案
從共用資料夾下載一個檔案:
smb: \> get 3389.txt /lee/bak/test.txt
上傳一個檔案到共用資料夾:
smb: \> put /lee/bak/test.txt test.txt
其它命令略。
筆記:linux訪問windows共用