Linux基础命令smbclient的用法

2023-04-16 00:17:00 命令 基础 用法

smbclient是Linux系统中常用的一个命令行工具,它可以用来连接到Samba服务器,以访问共享文件夹。它也可以用来执行文件传输、建立连接、执行目录操作等。

smbclient的用法主要包括以下几点:

1.连接到Samba服务器:smbclient [-L hostname] [-U username] [-W workgroup] [-N] [-E] [-d debuglevel] [-p port] [-A authfile] [-s smb.conf]

2.查看共享文件夹:smbclient -L hostname [-U username] [-W workgroup] [-N] [-E] [-d debuglevel] [-p port] [-A authfile] [-s smb.conf]

3.查看共享文件夹内容:smbclient //hostname/sharename [-U username] [-W workgroup] [-N] [-E] [-d debuglevel] [-p port] [-A authfile] [-s smb.conf]

4.传输文件:smbclient //hostname/sharename [-U username] [-W workgroup] [-N] [-E] [-d debuglevel] [-p port] [-A authfile] [-s smb.conf] put localfile remotefile

5.查看远程文件:smbclient //hostname/sharename [-U username] [-W workgroup] [-N] [-E] [-d debuglevel] [-p port] [-A authfile] [-s smb.conf] get remotefile localfile

6.删除远程文件:smbclient //hostname/sharename [-U username] [-W workgroup] [-N] [-E] [-d debuglevel] [-p port] [-A authfile] [-s smb.conf] del remotefile

7.查看远程文件夹:smbclient //hostname/sharename [-U username] [-W workgroup] [-N] [-E] [-d debuglevel] [-p port] [-A authfile] [-s smb.conf] dir

8.查看远程文件夹中的文件:smbclient //hostname/sharename [-U username] [-W workgroup] [-N] [-E] [-d debuglevel] [-p port] [-A authfile] [-s smb.conf] dir remotefolder

9.创建远程文件夹:smbclient //hostname/sharename [-U username] [-W workgroup] [-N] [-E] [-d debuglevel] [-p port] [-A authfile] [-s smb.conf] mkdir remotefolder

10.删除远程文件夹:smbclient //hostname/sharename [-U username] [-W workgroup] [-N] [-E] [-d debuglevel] [-p port] [-A authfile] [-s smb.conf] rmdir remotefolder

smbclient的用法非常简单,只要掌握了上面的命令,就可以轻松地连接到Samba服务器,访问共享文件夹,执行文件传输、建立连接、执行目录操作等操作。

相关文章