Linux basic commands ---- smbclient

smbclient

     smbclient is a client hypervisor smb server, you can access the interactive samba server.

     Scope of this command: RedHat, RHEL, Ubuntu, CentOS, Fedora, SUSE, openSUSE.

 

1 , grammar

     smbclient servername [ Options]

 

2 , the list of options

Options

Explanation

-? | --help

Displays help documentation

-V | --version

Displays command version information

-R | --name-resolve

NetBIOS names into IP addresses corresponding to the order

-M | --message

Sending messages protocol winpopup

-p | --port

Specify the connection port, the default TCP 139

-m | --max-protocol

The largest version of the protocol

-I | --ip-address

Specify the ip address for the connection

-E | --stderr

The standard error information to the device

-L | --list

Resource list display server

-b | --send-buffer

Set the buffer size of the transmission

-e | --encyrpt

Server requires encryption using

-d | --debuglevel

Set debug mode level, the higher the level of detail displayed in the log on month

-l | ---log-basename

The log file storage directory

-N | --no-pass

Without a password

-A

Reads the user name and password from the specified file, the file format is as follows:

username=<value>

password=<value>

domain=<value>

-U | --user=username[%password]

Specify a username and password

-n

Specifies the NetBIOS name

-W | --workgroup

Specifies the user's domain smb

-T | --tar

The packaging server to share files to tar format

-s

Smb.conf specified directory

 

3 , command

After logging samba server Supported commands

command

Explanation

-? [cmd]

Documentation show command, if you do not specify a command, the command lists all documents

[shell]

Run shell

allinfo  file

It asks the server to return all files or directories

altname file

Ask the server returns the file or directory aliases

archive<num>

Set archive level

blocksize<size>

Packaged set the block size, the default 20. Block unit 521B is

case_sensitive

Set file case sensitive

cd

Change directory

chmod

Modify permissions

chown

Modify uid and gid

close <fd>

Close the file opened using the open

del <mask>

Files conforming to mask the current directory

of

List directory information and disk information

echo<number> <data>

Effect of this instruction is to send a test message to the server ping

exit

drop out

get

Get File

hardlink<src> <dst>

创建硬连接

iosize <bytes>

设置传输文件时使用内存缓冲区的大小,默认64512字节,可以设置的范围16384~16776960

lowercase

将受到的文件中字母都改成小写

ls

查看目录信息

md

创建目录

mget <mask>

获取所有匹配mask的文件

mkdir

创建目录

mput <mask>

发送当前目录下所有匹配msak的文件到服务器

put <local file> [remote file]

发送文件

queue

显示打印队列

quit

退出

rd

删除目录

rmdir

删除目录

recurse

改变递归选项的开关

rename

重命名

rm <mask>

删除当前目录下所有匹配mask的文件

showconnect

显示当前连接

stat file

显示文件信息

tar

压缩文件

 

4、实例

1)连接服务器

[root@localhost ~]# cat wj.txt                //查看文件内容

username=david

password=543092

[root@localhost ~]# smbclient //192.168.1.8/wj -A wj.txt           //登录服务器,从指定文件读取用户名和密码

Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.6.23-51.el6]

smb: \> 

2)查看命令

smb: \> ?           //列出支持的命令

?              allinfo        altname        archive        blocksize      

cancel         case_sensitive cd             chmod          chown          

close          del            dir            du             echo           

exit           get            getfacl        geteas         hardlink       

help           history        iosize         lcd            link           

lock           lowercase      ls             l              mask           

md             mget           mkdir          more           mput           

newer          open           posix          posix_encrypt  posix_open     

posix_mkdir    posix_rmdir    posix_unlink   print          prompt         

put            pwd            q              queue          quit           

readlink       rd             recurse        reget          rename         

reput          rm             rmdir          showacls       setea          

setmode        stat           symlink        tar            tarmode        

timeout        translate      unlock         volume         vuid           

wdel           logon          listconnect    showconnect    ..             

!              

smb: \> ? allinfo             //查看指定命令的帮助信息

HELP allinfo:

    <file> show all available info

 

smb: \> 

3)上传文件

 smb: \> put wj.txt             //上传文件

putting file wj.txt as \wj.txt (10.1 kb/s) (average 10.1 kb/s)

smb: \> ls wj.txt             //查看文件,已经上床

  wj.txt                              A       31  Tue Oct  9 09:15:22 2018

 

       49907 blocks of size 524288. 2282 blocks available

smb: \> 

 

 

      做了一个Linux学习的平台,目前出来一个雏形,各位可以参考使用
      链接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ  密码:n7bk  

     

Guess you like

Origin www.cnblogs.com/wj78080458/p/10847690.html