《一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码》,点击传送门,即可获取!
Failed to connect with SMB1 – no workgroup available
[root@centos76_3 ccx]#
- 使用有2中方式,1:直接登录 , 2:挂载
直接登录共享
- 命令格式:
smbclient //主ip/路径 -U 用户名%密码
如,smbclient //192.168.26.1/D -U tom%111111
【注:windows中是\IP,linux中是//IP】
[root@centos76_3 ccx]# smbclient //192.168.59.131/C -U ccx%ccx #登录
Try “help” to get a list of possible commands.
smb: > ls #查看远程目录【我进入的共享C盘】
$Recycle.Bin DHS 0 Fri May 7 16:57:04 2021
bootmgr AHSR 395268 Fri Jul 10 19:00:31 2015
BOOTNXT AHS 1 Fri Jul 10 19:00:31 2015
Documents and Settings DHS 0 Fri Jul 10 20:21:38 2015
gongxiang D 0 Mon May 10 18:09:05 2021
pagefile.sys AHS 10200547328 Fri Apr 30 17:10:08 2021
PerfLogs D 0 Fri Jul 10 19:04:22 2015
Program Files DR 0 Fri Apr 30 17:07:40 2021
Program Files (x86) DR 0 Fri Jul 10 19:04:26 2015
ProgramData DH 0 Fri Apr 30 17:07:40 2021
Recovery DHS 0 Fri Apr 30 16:57:02 2021
swapfile.sys AHS 268435456 Fri Apr 30 17:10:08 2021
System Volume Information DHS 0 Mon May 10 10:27:16 2021
Users DR 0 Fri Apr 30 17:10:23 2021
Windows D 0 Fri Apr 30 16:59:13 2021
78514687 blocks of size 4096. 73498041 blocks available
smb: > pwd # 查看远程目录,如果想看本地路径,!pwd
Current directory is \192.168.59.131\C\
- 这种方式登录进去以后需要使用命令来进行操作
使用以下参数【在smb:\>
环境中(登录成功就这界面)】:
-
ls
#同dir, 列出远程目录 -
!ls
#列出本地目录【linux】 -
pwd
#查看当前工作目录 -
get
# 下载单个文件 -
mget
# 批量下载 -
put
#单个上传 -
mput
#批量上传 -
?
#各种交互命令的在线帮助 -
help
-
lcd目录
#切换本地目录 -
cd目录
#切换共享目录 -
mgetiptraf*
#下载名称以iptraf开头的文件 -
quit
#退出共享目录 -
ls
下载的文件目录
注意:
get和 mget 下载的路径为进入到共享目录前的本地目录
若要改变下下载路径可以切换本地路径 lcd 本地路径
这些参数和ftp参数是通用的,想了解更多直接去这篇文件看:ftp客户端使用详细说明【linux和windows】
- 上传下载demo
注意看命令后面注释
注:
[root@centos76_3 ~]# smbclient //192.168.59.131/C -U ccx%ccx #登录
Try “help” to get a list of possible commands.
smb: > ls #查看远程目录
$Recycle.Bin DHS 0 Fri May 7 16:57:04 2021
bootmgr AHSR 395268 Fri Jul 10 19:00:31 2015
BOOTNXT AHS 1 Fri Jul 10 19:00:31 2015
Documents and Settings DHS 0 Fri Jul 10 20:21:38 2015
gongxiang D 0 Tue May 11 09:36:24 2021
pagefile.sys AHS 10200547328 Fri Apr 30 17:10:08 2021
PerfLogs D 0 Fri Jul 10 19:04:22 2015
Program Files DR 0 Fri Apr 30 17:07:40 2021
Program Files (x86) DR 0 Fri Jul 10 19:04:26 2015
ProgramData DH 0 Fri Apr 30 17:07:40 2021
Recovery DHS 0 Fri Apr 30 16:57:02 2021
swapfile.sys AHS 268435456 Fri Apr 30 17:10:08 2021
System Volume Information DHS 0 Mon May 10 10:27:16 2021
Users DR 0 Fri Apr 30 17:10:23 2021
Windows D 0 Fri Apr 30 16:59:13 2021
78514687 blocks of size 4096. 73497573 blocks available
smb: > cd gongxiang\ #进入c盘的gongxiang目录
smb: \gongxiang> ls
. D 0 Tue May 11 09:36:24 2021
… D 0 Tue May 11 09:36:24 2021
aaa.txt A 6 Tue May 11 09:36:32 2021
78514687 blocks of size 4096. 73497573 blocks available
smb: \gongxiang> lcd /root/ccx/ #进入本地目录
smb: \gongxiang> !ls #本地文件
file1 file2 file3 test4 test5 test6
smb: \gongxiang> get aaa.txt #下载aaa文件
getting file \gongxiang\aaa.txt of size 6 as aaa.txt (2.0 KiloBytes/sec) (average 2.0 KiloBytes/sec)
smb: \gongxiang> !ls #文件已经被下载
aaa.txt file1 file2 file3 test4 test5 test6
smb: \gongxiang> put test4 #权限被拒绝了,因为是这是c盘的原因,不允许远程搞【虚拟机只有一个c盘,懒得添硬盘测了,反正就是这样操作的】
NT_STATUS_ACCESS_DENIED opening remote file \gongxiang\test4
smb: \gongxiang> ls
. D 0 Tue May 11 09:36:24 2021
… D 0 Tue May 11 09:36:24 2021
aaa.txt A 6 Tue May 11 09:36:32 2021
78514687 blocks of size 4096. 73497573 blocks available
smb: \g