smbclient 簡單應用

gaopengtttt發表於2008-12-01

本文連結:http://user.qzone.qq.com/317352042/blog/1196438857

功能說明:
在Windows作業系統之間,可以通過網路上的芳鄰或UNC路徑的方式,訪問某個共享,在Linux下,可以通過smbclient命令來實現相似的功能,訪問Windows的某個共享目錄。
測試平臺:
Red Hat Enterprise Linux AS release 3 (Taroon)
Windows 2000 Advanced Server SP4
當前測試條件:
1、 Windows和Linux共處於同一個區域網中,可以互相ping通,都未設定防火牆
2、 Windows的IP地址:192.168.60.188
3、 Linux的IP地址:192.168.60.189
4、 Windows上當前有如下共享:c$,temp(everyone具有讀取許可權)
5、 Windows上的使用者有cmw(管理員組使用者帳號),grp(管理員組使用者帳號),guest(當前未啟用),沒有root帳號
6、Linux上安裝有相關的RPM包:samba-client,它是Samba客戶端工具
基本測試過程如下:
1、 訪問c$共享:
[root@rh root]# smbclient //192.168.60.188/c$ -U cmw
Password:                                          
smb: \> cd winnt                                    
smb: \winnt\>                                      
2、 訪問temp共享(啟用guest帳戶)
[root@rh root]# smbclient //192.168.60.188/temp
Password:(未輸入任何密碼)
smb: \>                                        
3、 訪問temp共享(未啟用guest帳戶)
[root@rh root]# smbclient //192.168.60.188/temp
Password:(未輸入任何密碼)
Anonymous login successful                    
tree connect failed: NT_STATUS_ACCESS_DENIED  
[root@rh root]#                                
擴充套件研究:
1、 smbclient命令成功後,可以使用的命令及研究:
[root@rh root]# smbclient //192.168.60.188/temp -U cmw                    
Password:                                                                
smb: \> ?                                                                
?
altname
archive
blocksize
cancel
cd
chmod
chown
del
dir
du
exit
get
help
history
lcd
link
lowercase
ls
mask
md
mget
mkdir
more
mput
newer
open
print
printmode
prompt
put
pwd
q
queue
quit
rd
recurse
reget
rename
reput
rm
rmdir
setmode
symlink
tar
tarmode
translate
!
以上為可以使用的命令,常用命令如下:
1)        ?命令
smb: \> ? ?                                          
HELP ?:                                              
        [command] give help on a command              
語法:? [command]
功能:可以檢視一個命令的使用方法
2)        cd命令
smb: \> ? cd                                          
HELP cd:                                              
        [directory] change/report the remote directory
smb: \> cd samba                                      
語法:cd [directory]
功能:改變遠端目錄
3)        du命令
smb: \samba\> ? du                                                
HELP du:                                                          
         computes the total size of the current directory    
smb: \samba\> du                                                  
                42293 blocks of size 1048576. 5098 blocks available
Total number of bytes: 16880894                                    
語法:du
功能:統計當前目錄下檔案總計大小,不包括子目錄容量。
4)
5)
1、 smbclient命令的其它引數,待續……
      2、其它,待續……

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-504280/,如需轉載,請註明出處,否則將追究法律責任。

相關文章