首先安裝smbclient
yum install samba-client
or
apt install samba-client
1,列出某個IP地址所提供的共享文件夾
smbclient -L 198.168.0.1 -U username -W domain (會提示輸密碼)
smbclient -L 198.168.0.1 -U username%password -W domain
2,像FTP客戶端一樣使用smbclient
smbclient //192.168.0.1/tmp -U username -W domain (會提示輸密碼)
smbclient //192.168.0.1/tmp -U username%password -W domain
執行smbclient命令成功后,進入smbclient環境,出現提示符: smb:/>
這里有許多命令和ftp命令相似,如cd 、lcd、get、megt、put、mput等。通過這些命令,我們可以訪問遠程主機的共享資源。
3,直接一次性使用smbclient命令
smbclient -c "ls" //192.168.0.1/tmp -U username%password
和
smbclient //192.168.0.1/tmp -U username%password
smb:/>ls
功能一樣的
例,創建一個共享文件夾
smbclient -c "mkdir share1" //192.168.0.1/tmp -U username%password
如果用戶共享//192.168.0.1/tmp的方式是只讀的,會提示
NT_STATUS_ACCESS_DENIED making remote directory /share1