Linux 版 (精华区)
发信人: tcpip (高级草包), 信区: Linux
标 题: smbclient (1)--a
发信站: 紫 丁 香 (Fri May 5 20:08:57 2000) WWW-POST
------------------------------------------------------------------------------
--
smbclient (1)
Samba
23 Oct 1998
NAME
名称
smbclient - ftp-like client to access SMB/CIFS resources on servers
smbclient - 类似FTP操作方式的访问SMB/CIFS服务器资源的客户端
SYNOPSIS
语法
smbclient servicename [-s smb.conf] [-O socket options][-R name resolve
order] [-M NetBIOS name] [-i scope] [-N] [-n NetBIOS name] [-d debuglevel]
[-P] [-p port] [-l log basename] [-h] [-I dest IP] [-E] [-U username] [-L
NetBIOS name] [-t terminal code] [-m max protocol] [-b buffersize] [-W
workgroup] [-T<c|x>IXFqgbNan] [-D directory] [-c command string]
DESCRIPTION
描述
This program is part of the Samba suite.
此程序是samba套件的一部分。
smbclient is a client that can 'talk' to an SMB/CIFS server. It offers an
interface similar to that of the ftp program (see ftp (1)). Operations
include things like getting files from the server to the local machine,
putting files from the local machine to the server, retrieving directory
information from the server and so on.
smbclient是个可以和SMB/CIFS服务器“交谈”的客户端程序。它提供了类似FTP程序(参
见ftp (1))的用户界面。它可以完成的操作包括象从服务器下载文件到本地,上传本地文
件到服务器及在服务器上查找目录信息等。
OPTIONS
选项
servicename
servicename is the name of the service you want to use on the server. A
service name takes the form //server/service where server is the NetBIOS name
of the SMB/CIFS server offering the desired service and service is the name
of the service offered. Thus to connect to the service printer on the
SMB/CIFS server smbserver, you would use the servicename
servicename就是你要使用的服务名称。服务名使用//server/service这样的形式,其中
server是提供服务的SMB/CIFS服务器的NetBIOS名字,而service是可获得服务资源的名称
。所以如果要联接服务器smbserver上的printer服务的话,应该使用这样的服务名称:
//smbserver/printer
Note that the server name required is NOT necessarily the IP (DNS) host name
of the server ! The name required is a NetBIOS server name, which may or may
not be the same as the IP hostname of the machine running the server.
注意服务名不能使用服务器IP(或DNS)主机名,而应该用NetBIOS名,而它可能与服务器的
IP主机名相同当然也可能不相同。
The server name is looked up according to either the -R parameter to
smbclient or using the name resolve order parameter in the smb.conf file,
allowing an administrator to change the order and methods by which server
names are looked up.
可以根据smbclient使用的-R参数或者用smb.conf配置文件中的name resolve order参数
来更改查找顺序和查找方式来查询服务器名。
password
password is the password required to access the specified service on the
specified server. If this parameter is supplied, the -N option (suppress
password prompt) is assumed.
用password指定访问服务时所需的口令。如果使用了这个选项,-N就不再起作用从而在执
行过程中不出现口令提示。
There is no default password. If no password is supplied on the command line
(either by using this parameter or adding a password to the -U option (see
below)) and the -N option is not specified, the client will prompt for a
password, even if the desired service does not require one. (If no password
is required, simply press ENTER to provide a null password.)
samba没有默认口令。如果在命令行上没有提供口令(可能在用两种选项时可以同时提供口
令:第一就是这个选项,另外一个就是在使用-U选项时),并且也没有使用-N选项,那么
即使需要的服务项不要求口令,程序也会提供要用户输入一个口令。(如果服务不需要口
令,只要简单地打个回车就向服务器回应了一个空口令)
Note: Some servers (including OS/2 and Windows for Workgroups) insist on an
uppercase password. Lowercase or mixed case passwords may be rejected by
these servers.
注意:有些服务器(包括OS/2和Windows for Workgroups)会强调使用大写口令,它们会拒
绝小写或者大小写混合的口令。
Be cautious about including passwords in scripts.
在脚本中使用口令要小心。(可能有安全问题嘛!)
-s smb.conf
This parameter specifies the pathname to the Samba configuration file,
smb.conf. This file controls all aspects of the Samba setup on the machine
and smbclient also needs to read this file.
用这个选项来指定samba配置文件smb.conf的路径。此文件包含samba的全部设置,
smbclient也需要读取这个文件。
-O socket options
TCP socket options to set on the client socket. See the socket options
parameter in the smb.conf (5) manpage for the list of valid options.
TCP套接字选项用来在客户端设定套接字方面的功能。参见smb.conf (5)手册页中的
socket options参数获得合法的选项列表。
-R name resolve order
This option allows the user of smbclient to determine what name resolution
services to use when looking up the NetBIOS name of the host being connected
to.
通过指定这个选项让smbclient的用户决定使用怎样的名字解析服务次序来查询要联接主
机的NetBIOS名字。
The options are :"lmhosts", "host", "wins" and "bcast". They cause names to
be resolved as follows :
这些内容是:“lmhosts”,“host”,“wins”和“bcast”。这些选项使名字解析按以
下的方法来进行:
lmhosts : Lookup an IP address in the Samba lmhosts file. The lmhosts file is
stored in the same directory as the smb.conf file.
lmhosts:向samba的lmhosts文件查询IP地址。lmhosts文件存放在与smb.conf文件相同的
目录下。
host : Do a standard host name to IP address resolution, using the system
/etc/hosts, NIS, or DNS lookups. This method of name resolution is operating
system depended for instance on IRIX or Solaris this may be controlled by the
/etc/nsswitch.conf file).
host:用标准的名字到IP地址解析方法:系统/etc/hosts文件,NIS或DNS查询。如何使用
这个名字解析由系统决定。举例来说,在IRIX或者Solaris系统中,/etc/nsswitch.conf
文件会处理这些问题。
wins : Query a name with the IP address listed in the wins server parameter
in the smb.conf file. If no WINS server has been specified this method will
be ignored.
wins:用smb.conf配置文件中wins server参数列出的地址来查询名字。如果没有指定
WINS服务器的话会略过这种方法。
bcast : Do a broadcast on each of the known local interfaces listed in the
interfaces parameter in the smb.conf file. This is the least reliable of the
name resolution methods as it depends on the target host being on a locally
connected subnet.
bcast:向smb.conf配置文件中interfaces参数列出的每个已知本地接口进行广播来进行
查询。当目标主机联接到本地子网时这是最可靠的名字解析方法。
If this parameter is not set then the name resolve order defined in the
smb.conf file parameter (name resolve order) will be used.
如果不使用这个参数的话,将按smb.conf配置文件中(name resolve order)参数指定的次
序来进行名字解析。
The default order is lmhosts, host, wins, bcast and without this parameter or
any entry in the "name resolve order" parameter of the smb.conf file the name
resolution methods will be attempted in this order.
默认的解析次序是lmhosts,host,wins,bcast,在不使用这个参数或者没有在smb.conf
配置文件中设定"name resolve order"参数的情况下将使用这样的次序进行解析。
-M NetBIOS name
This options allows you to send messages, using the "WinPopup" protocol, to
another computer. Once a connection is established you then type your
message, pressing ^D (control-D) to end.
使用这个选项可以让你以“WinPopup协议”向其它计算机发送信息。一旦联接成功你就可
以发送信息了,结束时可以按^D(Ctl-D).
If the receiving computer is running WinPopup the user will receive the
message and probably a beep. If they are not running WinPopup the message
will be lost, and no error message will occur.
如果接受方计算机也正在运行WinPopup的话,用户会收到发送的信息并且系统可能会鸣叫
一声。如果对方并没有运行WinPopup的话信息就被丢弃,而不会发出出错信息。
The message is also automatically truncated if the message is over 1600
bytes, as this is the limit of the protocol.
如果发送的信息超过1600字节的话会自动被载断,因为这是此协议规定的极限。
One useful trick is to cat the message through smbclient. For example:
这里有个很有用的小技巧,通过smbclient来用cat处理信息,例如:
cat mymessage.txt | smbclient -M FRED
will send the message in the file mymessage.txt to the machine FRED.
这个命令将会把文件mymessage.txt中的信息发送到主机FRED之上。
You may also find the -U and -I options useful, as they allow you to control
the FROM and TO parts of the message.
你也许会发现-U和-I选项很有用,因为它们允许你控制信息的源地址和目的地址部分。
See the message command parameter in the smb.conf (5) for a description of
how to handle incoming WinPopup messages in Samba.
参见smb.conf (5)配置文件中的message command参数获得如何在samba中处理新进的
WinPopup消息的详细描述。
Note: Copy WinPopup into the startup group on your WfWg PCs if you want them
to always be able to receive messages.
提示:如果你总是要用WinPopup来接收消息的话可以在你的Windows机器中把它拷到启动
群组中。
-i scope
This specifies a NetBIOS scope that smbclient will use to communicate with
when generating NetBIOS names. For details on the use of NetBIOS scopes, see
rfc1001.txt and rfc1002.txt. NetBIOS scopes are very rarely used, only set
this parameter if you are the system administrator in charge of all the
NetBIOS systems you communicate with.
这个参数指定一个smbclient产生NetBIOS名字通信时所需要的NetBIOS范围。对于NetBIOS
范围这个概念,可以参见rfc1001.txt和rfc1002.txt这两个文件中的详细定义。实际上这
个NetBIOS范围的概念很少被用到,仅当你作为负责整个NetBIOS通信的管理员时才要设置
。
-N
If specified, this parameter suppresses the normal password prompt from the
client to the user. This is useful when accessing a service that does not
require a password.
如果指定了这个选项,就会省略通常的口令提示。当访问无需口令的服务资源时它很有用
。
Unless a password is specified on the command line or this parameter is
specified, the client will request a password.
除非在命令行上输入了口令或者使用了上述这个选项,否则用户将被提示要求输入一个口
令。
-n NetBIOS name
By default, the client will use the local machine's hostname (in uppercase)
as its NetBIOS name. This parameter allows you to override the host name and
use whatever NetBIOS name you wish.
默认情况下,客户端会用本地主机的主机名(大写)来作为它的NetBIOS名字。使用这个选
项让你越过机器的主机名而使用你要用的NetBIOS名。
-d debuglevel
debuglevel is an integer from 0 to 10, or the letter 'A'.
调试等级是个从0到10的整数。
The default value if this parameter is not specified is zero.
参数未指定时默认值为0。
The higher this value, the more detail will be logged to the log files about
the activities of the client. At level 0, only critical errors and serious
warnings will be logged. Level 1 is a reasonable level for day to day running
- it generates a small amount of information about operations carried out.
如果这个值越高,越多关于服务器的详细活动信息将被记录到文件中。在0调试级时,只
记录紧急错误和严重警告。对于日以即日地运行服务,1调试级是个合理的等级,它只产
生一定数量的关于执行操作的信息。
Levels above 1 will generate considerable amounts of log data, and should
only be used when investigating a problem. Levels above 3 are designed for
use only by developers and generate HUGE amounts of log data, most of which
is extremely cryptic. If debuglevel is set to the letter 'A', then all debug
messages will be printed. This setting is for developers only (and people who
really want to know how the code works internally).
1以上的调试级将产生相当多的记录数据,并且只在研究问题时才有用。3以上的调试级只
被设计为让开发者使用并会产生极大数量的记录数据,而且其中很多部分非常难以理解。
如果把调试等级设成字母‘A’的话,所有的调试信息都会被打印出来,这种设法只对开
发者有用(有些人希望真正知道代码内部是如何工作的)
Note that specifying this parameter here will override the log level
parameter in the smb.conf (5) file.
注意在此使用这个参数将越过在smb.conf (5)文件中的log level参数。
-P
This option is no longer used. The code in Samba2.0 now lets the server
decide the device type, so no printer specific flag is needed.
这个选项现在不再有用了。samba 2.0的代码让服务自己来决定设备类型,所以不需要指
定打印机的标志了。
-p port
This number is the TCP port number that will be used when making connections
to the server. The standard (well-known) TCP port number for an SMB/CIFS
server is 139, which is the default.
联接服务器所用的TCP端口号。标准(众所周知)的SMB/CIFS服务器TCP端口是139,当然也
是默认值。
-l logfilename
If specified, logfilename specifies a base filename into which operational
data from the running client will be logged.
用参数-l可以指定一个基本的文件名用于client把操作数据记录到该文件中。
The default base name is specified at compile time.
编译时已经指定了默认的基本文件名。
The base name is used to generate actual log file names. For example, if the
name specified was "log", the debug file would be log.client.
基本文件名被用于产生实际的记录文件名。例如,如果指定名字为“log”,那么调试文
件名将会是log.client。
The log file generated is never removed by the client.
client无法删除产生的记录文件。
-h
Print the usage message for the client.
打印出client的帮助信息。
-I IP address
IP address is the address of the server to connect to. It should be specified
in standard "a.b.c.d" notation.
指定要联接的服务器IP地址。当然格式应该是“a.b.c.d”。
Normally the client would attempt to locate a named SMB/CIFS server by
looking it up via the NetBIOS name resolution mechanism described above in
the name resolve order parameter above. Using this parameter will force the
client to assume that the server is on the machine with the specified IP
address and the NetBIOS name component of the resource being connected to
will be ignored.
通常client会使用上面介绍过的name resolve order参数中描述的NetBIOS名字解析机制
通过查询尝试查找一个已命名的SMB/CIFS服务器。使用这个参数会强制client程序采用指
定的IP地址而忽略要联接的服务资源的NetBIOS名部分。
There is no default for this parameter. If not supplied, it will be
determined automatically by the client as described above.
这个参数并没有默认值。如果不指定的话程序会用上面说的方法来自动检测。
-E
This parameter causes the client to write messages to the standard error
stream (stderr) rather than to the standard output stream.
当使用了这个参数后,程序会把信息写到标准错误流(stderr)而不是标准输入流中。
By default, the client writes messages to standard output - typically the
user's tty.
默认情况下,程序会把信息写入标准输入中 - 典型的例子是用户的tty。
-U username
This specifies the user name that will be used by the client to make a
connection, assuming your server is not a downlevel server that is running a
protocol level that uses passwords on shares, not on usernames.
这个参数指定程序联接时使用的用户名,当然这假定你的服务并不是一个使用使用共享级
而不使用用户级的低级服务器。
Some servers are fussy about the case of this name, and some insist that it
must be a valid NetBIOS name.
一些服务器对名字的处理很挑剔,它们坚持客户必须有一个合法的NetBIOS名字。
If no username is supplied, it will default to an uppercase version of the
environment variable USER or LOGNAME in that order. If no username is
supplied and neither environment variable exists the username "GUEST" will be
used.
如果不提供用户名,程序会使用环境变量USER或LOGNAME的大写形式。如果既没有用户名
也不存在环境变量的话,将使用“GUEST”作为用户名。
If the USER environment variable contains a '%' character, everything after
that will be treated as a password. This allows you to set the environment
variable to be USER=username%password so that a password is not passed on the
command line (where it may be seen by the ps command).
如果USER环境变量包含一个‘%’字符,那么这个字符后面所跟的任何东西都会被看成是
个口令。这种情况允许你把环境变量设成USER=用户名%口令这种形式以使命令行上可以不
出现口令输入(但可能会被ps命令找到)。
If the service you are connecting to requires a password, it can be supplied
using the -U option, by appending a percent symbol ("%") then the password to
username. For example, to attach to a service as user "fred" with password
"secret", you would specify.
如果你联接的服务资源要求一个口令,可以用-U选项后面跟上一个用户名%口令的形式来
输入。例如,以用户“fred”和口令“secret”联接服务器时,可以在命令上指定:
-U fred%secret
on the command line. Note that there are no spaces around the percent
symbol.
注意在%号周围没有空格。
If you specify the password as part of username then the -N option (suppress
password prompt) is assumed.
如果只用了用户名部分和%号的话程序就会采用-N选项(也就是不提示要口令了)。
If you specify the password as a parameter AND as part of username then the
password as part of username will take precedence. Putting nothing before or
nothing after the percent symbol will cause an empty username or an empty
password to be used, respectively.
如果即用口令参数同时又用这个-U加用户名%口令形式时后者中的口令部分将会优先。如
果%号前或后项空白的话将分别使用空用户名或空口令。
The password may also be specified by setting up an environment variable
called PASSWD that contains the users password. Note that this may be very
insecure on some systems but on others allows users to script smbclient
commands without having a password appear in the command line of a process
listing.
也可以通过调用设定好的环境变量PASSWD部分来指定口令。注意这样做在一些系统中是非
常不安全的,而在其它一些系统中允许用户把命令行处理列表写入脚本以使smbclient在
命令行不出现口令。
Note: Some servers (including OS/2 and Windows for Workgroups) insist on an
uppercase password. Lowercase or mixed case passwords may be rejected by
these servers.
注意:一些服务器(包括OS/2和Windows for Workgroups)强调要大写口令。小写或者大小
写混合口令可能会被拒绝。
Be cautious about including passwords in scripts or in the PASSWD environment
variable. Also, on many systems the command line of a running process may be
seen via the ps command to be safe always allow smbclient to prompt for a
password and type it in directly.
在脚本中包含口令或者使用PASSWD环境变量时要小心。而且在很多系统命令行上运行的处
理命令可以通过ps命令来查看,所以让smbclient提示输入口令并直接键入会比较安全。
-L
This option allows you to look at what services are available on a server.
You use it as "smbclient -L host" and a list should appear. The -I option may
be useful if your NetBIOS names don't match your tcp/ip dns host names or if
you are trying to reach a host on another network.
此选项允许你查看服务器上可以获得的服务资源。使用“smbclient -L host”命令会显
示一份列表。如果你的NetBIOS名与TCP/IP域名不匹配或者要在其它网络上查找主机时,
-I选项会非常有用。
--
"这一千多年没写诗了?"
"写了, 不过只写了两句."
"千年得两句, 一定是万古丽句了. 念来听听."
"好吧, 我现丑了" 太白星清了清嗓子, 浑厚的男中音在天庭响起:
大海啊, 都是水;
骏马啊, 四条腿;
※ 来源:·紫 丁 香 bbs.hit.edu.cn·[FROM: freesrc.hit.edu]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:206.544毫秒