| 1 | '\" t
|
|---|
| 2 | .\" Title: smbclient
|
|---|
| 3 | .\" Author: [see the "AUTHOR" section]
|
|---|
| 4 | .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
|---|
| 5 | .\" Date: 05/02/2016
|
|---|
| 6 | .\" Manual: User Commands
|
|---|
| 7 | .\" Source: Samba 4.4
|
|---|
| 8 | .\" Language: English
|
|---|
| 9 | .\"
|
|---|
| 10 | .TH "SMBCLIENT" "1" "05/02/2016" "Samba 4\&.4" "User Commands"
|
|---|
| 11 | .\" -----------------------------------------------------------------
|
|---|
| 12 | .\" * Define some portability stuff
|
|---|
| 13 | .\" -----------------------------------------------------------------
|
|---|
| 14 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|---|
| 15 | .\" http://bugs.debian.org/507673
|
|---|
| 16 | .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
|---|
| 17 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|---|
| 18 | .ie \n(.g .ds Aq \(aq
|
|---|
| 19 | .el .ds Aq '
|
|---|
| 20 | .\" -----------------------------------------------------------------
|
|---|
| 21 | .\" * set default formatting
|
|---|
| 22 | .\" -----------------------------------------------------------------
|
|---|
| 23 | .\" disable hyphenation
|
|---|
| 24 | .nh
|
|---|
| 25 | .\" disable justification (adjust text to left margin only)
|
|---|
| 26 | .ad l
|
|---|
| 27 | .\" -----------------------------------------------------------------
|
|---|
| 28 | .\" * MAIN CONTENT STARTS HERE *
|
|---|
| 29 | .\" -----------------------------------------------------------------
|
|---|
| 30 | .SH "NAME"
|
|---|
| 31 | smbclient \- ftp\-like client to access SMB/CIFS resources on servers
|
|---|
| 32 | .SH "SYNOPSIS"
|
|---|
| 33 | .HP \w'\ 'u
|
|---|
| 34 | smbclient [\-b\ <buffer\ size>] [\-d\ debuglevel] [\-e] [\-L\ <netbios\ name>] [\-U\ username] [\-I\ destinationIP] [\-M\ <netbios\ name>] [\-m\ maxprotocol] [\-A\ authfile] [\-N] [\-C] [\-g] [\-i\ scope] [\-O\ <socket\ options>] [\-p\ port] [\-R\ <name\ resolve\ order>] [\-s\ <smb\ config\ file>] [\-t\ <per\-operation\ timeout\ in\ seconds>] [\-k] [\-P] [\-c\ <command>]
|
|---|
| 35 | .HP \w'\ 'u
|
|---|
| 36 | smbclient {servicename} [password] [\-b\ <buffer\ size>] [\-d\ debuglevel] [\-e] [\-D\ Directory] [\-U\ username] [\-W\ workgroup] [\-M\ <netbios\ name>] [\-m\ maxprotocol] [\-A\ authfile] [\-N] [\-C] [\-g] [\-l\ log\-basename] [\-I\ destinationIP] [\-E] [\-c\ <command\ string>] [\-i\ scope] [\-O\ <socket\ options>] [\-p\ port] [\-R\ <name\ resolve\ order>] [\-s\ <smb\ config\ file>] [\-t\ <per\-operation\ timeout\ in\ seconds>] [\-T<c|x>IXFqgbNan] [\-k]
|
|---|
| 37 | .SH "DESCRIPTION"
|
|---|
| 38 | .PP
|
|---|
| 39 | This tool is part of the
|
|---|
| 40 | \fBsamba\fR(7)
|
|---|
| 41 | suite\&.
|
|---|
| 42 | .PP
|
|---|
| 43 | smbclient
|
|---|
| 44 | is a client that can \*(Aqtalk\*(Aq to an SMB/CIFS server\&. It offers an interface similar to that of the ftp program (see
|
|---|
| 45 | \fBftp\fR(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\&.
|
|---|
| 46 | .SH "OPTIONS"
|
|---|
| 47 | .PP
|
|---|
| 48 | servicename
|
|---|
| 49 | .RS 4
|
|---|
| 50 | servicename is the name of the service you want to use on the server\&. A service name takes the form
|
|---|
| 51 | //server/service
|
|---|
| 52 | where
|
|---|
| 53 | \fIserver \fR
|
|---|
| 54 | is the NetBIOS name of the SMB/CIFS server offering the desired service and
|
|---|
| 55 | \fIservice\fR
|
|---|
| 56 | 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
|
|---|
| 57 | //smbserver/printer
|
|---|
| 58 | .sp
|
|---|
| 59 | 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\&.
|
|---|
| 60 | .sp
|
|---|
| 61 | The server name is looked up according to either the
|
|---|
| 62 | \fI\-R\fR
|
|---|
| 63 | parameter to
|
|---|
| 64 | smbclient
|
|---|
| 65 | or using the name resolve order parameter in the
|
|---|
| 66 | \fBsmb.conf\fR(5)
|
|---|
| 67 | file, allowing an administrator to change the order and methods by which server names are looked up\&.
|
|---|
| 68 | .RE
|
|---|
| 69 | .PP
|
|---|
| 70 | password
|
|---|
| 71 | .RS 4
|
|---|
| 72 | The password required to access the specified service on the specified server\&. If this parameter is supplied, the
|
|---|
| 73 | \fI\-N\fR
|
|---|
| 74 | option (suppress password prompt) is assumed\&.
|
|---|
| 75 | .sp
|
|---|
| 76 | 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
|
|---|
| 77 | \fI\-U\fR
|
|---|
| 78 | option (see below)) and the
|
|---|
| 79 | \fI\-N\fR
|
|---|
| 80 | 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\&.)
|
|---|
| 81 | .sp
|
|---|
| 82 | 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\&.
|
|---|
| 83 | .sp
|
|---|
| 84 | Be cautious about including passwords in scripts\&.
|
|---|
| 85 | .RE
|
|---|
| 86 | .PP
|
|---|
| 87 | \-R|\-\-name\-resolve <name resolve order>
|
|---|
| 88 | .RS 4
|
|---|
| 89 | This option is used by the programs in the Samba suite to determine what naming services and in what order to resolve host names to IP addresses\&. The option takes a space\-separated string of different name resolution options\&.
|
|---|
| 90 | .sp
|
|---|
| 91 | The options are :"lmhosts", "host", "wins" and "bcast"\&. They cause names to be resolved as follows:
|
|---|
| 92 | .sp
|
|---|
| 93 | .RS 4
|
|---|
| 94 | .ie n \{\
|
|---|
| 95 | \h'-04'\(bu\h'+03'\c
|
|---|
| 96 | .\}
|
|---|
| 97 | .el \{\
|
|---|
| 98 | .sp -1
|
|---|
| 99 | .IP \(bu 2.3
|
|---|
| 100 | .\}
|
|---|
| 101 | \fBlmhosts\fR: Lookup an IP address in the Samba lmhosts file\&. If the line in lmhosts has no name type attached to the NetBIOS name (see the
|
|---|
| 102 | \fBlmhosts\fR(5)
|
|---|
| 103 | for details) then any name type matches for lookup\&.
|
|---|
| 104 | .RE
|
|---|
| 105 | .sp
|
|---|
| 106 | .RS 4
|
|---|
| 107 | .ie n \{\
|
|---|
| 108 | \h'-04'\(bu\h'+03'\c
|
|---|
| 109 | .\}
|
|---|
| 110 | .el \{\
|
|---|
| 111 | .sp -1
|
|---|
| 112 | .IP \(bu 2.3
|
|---|
| 113 | .\}
|
|---|
| 114 | \fBhost\fR: Do a standard host name to IP address resolution, using the system
|
|---|
| 115 | /etc/hosts, NIS, or DNS lookups\&. This method of name resolution is operating system dependent, for instance on IRIX or Solaris this may be controlled by the
|
|---|
| 116 | /etc/nsswitch\&.conf
|
|---|
| 117 | file)\&. Note that this method is only used if the NetBIOS name type being queried is the 0x20 (server) name type, otherwise it is ignored\&.
|
|---|
| 118 | .RE
|
|---|
| 119 | .sp
|
|---|
| 120 | .RS 4
|
|---|
| 121 | .ie n \{\
|
|---|
| 122 | \h'-04'\(bu\h'+03'\c
|
|---|
| 123 | .\}
|
|---|
| 124 | .el \{\
|
|---|
| 125 | .sp -1
|
|---|
| 126 | .IP \(bu 2.3
|
|---|
| 127 | .\}
|
|---|
| 128 | \fBwins\fR: Query a name with the IP address listed in the
|
|---|
| 129 | \fIwins server\fR
|
|---|
| 130 | parameter\&. If no WINS server has been specified this method will be ignored\&.
|
|---|
| 131 | .RE
|
|---|
| 132 | .sp
|
|---|
| 133 | .RS 4
|
|---|
| 134 | .ie n \{\
|
|---|
| 135 | \h'-04'\(bu\h'+03'\c
|
|---|
| 136 | .\}
|
|---|
| 137 | .el \{\
|
|---|
| 138 | .sp -1
|
|---|
| 139 | .IP \(bu 2.3
|
|---|
| 140 | .\}
|
|---|
| 141 | \fBbcast\fR: Do a broadcast on each of the known local interfaces listed in the
|
|---|
| 142 | \fIinterfaces\fR
|
|---|
| 143 | parameter\&. This is the least reliable of the name resolution methods as it depends on the target host being on a locally connected subnet\&.
|
|---|
| 144 | .RE
|
|---|
| 145 | .sp
|
|---|
| 146 | .RE
|
|---|
| 147 | If this parameter is not set then the name resolve order defined in the
|
|---|
| 148 | \fBsmb.conf\fR(5)
|
|---|
| 149 | file parameter (name resolve order) will be used\&.
|
|---|
| 150 | .sp
|
|---|
| 151 | The default order is lmhosts, host, wins, bcast and without this parameter or any entry in the
|
|---|
| 152 | \fIname resolve order \fR
|
|---|
| 153 | parameter of the
|
|---|
| 154 | \fBsmb.conf\fR(5)
|
|---|
| 155 | file the name resolution methods will be attempted in this order\&.
|
|---|
| 156 | .RE
|
|---|
| 157 | .PP
|
|---|
| 158 | \-M|\-\-message NetBIOS name
|
|---|
| 159 | .RS 4
|
|---|
| 160 | 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\&.
|
|---|
| 161 | .sp
|
|---|
| 162 | 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\&.
|
|---|
| 163 | .sp
|
|---|
| 164 | The message is also automatically truncated if the message is over 1600 bytes, as this is the limit of the protocol\&.
|
|---|
| 165 | .sp
|
|---|
| 166 | One useful trick is to pipe the message through
|
|---|
| 167 | smbclient\&. For example: smbclient \-M FRED < mymessage\&.txt will send the message in the file
|
|---|
| 168 | mymessage\&.txt
|
|---|
| 169 | to the machine FRED\&.
|
|---|
| 170 | .sp
|
|---|
| 171 | You may also find the
|
|---|
| 172 | \fI\-U\fR
|
|---|
| 173 | and
|
|---|
| 174 | \fI\-I\fR
|
|---|
| 175 | options useful, as they allow you to control the FROM and TO parts of the message\&.
|
|---|
| 176 | .sp
|
|---|
| 177 | See the
|
|---|
| 178 | \fImessage command\fR
|
|---|
| 179 | parameter in the
|
|---|
| 180 | \fBsmb.conf\fR(5)
|
|---|
| 181 | for a description of how to handle incoming WinPopup messages in Samba\&.
|
|---|
| 182 | .sp
|
|---|
| 183 | \fINote\fR: Copy WinPopup into the startup group on your WfWg PCs if you want them to always be able to receive messages\&.
|
|---|
| 184 | .RE
|
|---|
| 185 | .PP
|
|---|
| 186 | \-p|\-\-port port
|
|---|
| 187 | .RS 4
|
|---|
| 188 | 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\&.
|
|---|
| 189 | .RE
|
|---|
| 190 | .PP
|
|---|
| 191 | \-g|\-\-grepable
|
|---|
| 192 | .RS 4
|
|---|
| 193 | This parameter provides combined with
|
|---|
| 194 | \fI\-L\fR
|
|---|
| 195 | easy parseable output that allows processing with utilities such as grep and cut\&.
|
|---|
| 196 | .RE
|
|---|
| 197 | .PP
|
|---|
| 198 | \-m|\-\-max\-protocol protocol
|
|---|
| 199 | .RS 4
|
|---|
| 200 | This allows the user to select the highest SMB protocol level that smbclient will use to connect to the server\&. By default this is set to NT1, which is the highest available SMB1 protocol\&. To connect using SMB2 or SMB3 protocol, use the strings SMB2 or SMB3 respectively\&. Note that to connect to a Windows 2012 server with encrypted transport selecting a max\-protocol of SMB3 is required\&.
|
|---|
| 201 | .RE
|
|---|
| 202 | .PP
|
|---|
| 203 | \-P|\-\-machine\-pass
|
|---|
| 204 | .RS 4
|
|---|
| 205 | Make queries to the external server using the machine account of the local server\&.
|
|---|
| 206 | .RE
|
|---|
| 207 | .PP
|
|---|
| 208 | \-I|\-\-ip\-address IP\-address
|
|---|
| 209 | .RS 4
|
|---|
| 210 | \fIIP address\fR
|
|---|
| 211 | is the address of the server to connect to\&. It should be specified in standard "a\&.b\&.c\&.d" notation\&.
|
|---|
| 212 | .sp
|
|---|
| 213 | 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
|
|---|
| 214 | \fIname resolve order\fR
|
|---|
| 215 | 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\&.
|
|---|
| 216 | .sp
|
|---|
| 217 | There is no default for this parameter\&. If not supplied, it will be determined automatically by the client as described above\&.
|
|---|
| 218 | .RE
|
|---|
| 219 | .PP
|
|---|
| 220 | \-E|\-\-stderr
|
|---|
| 221 | .RS 4
|
|---|
| 222 | This parameter causes the client to write messages to the standard error stream (stderr) rather than to the standard output stream\&.
|
|---|
| 223 | .sp
|
|---|
| 224 | By default, the client writes messages to standard output \- typically the user\*(Aqs tty\&.
|
|---|
| 225 | .RE
|
|---|
| 226 | .PP
|
|---|
| 227 | \-L|\-\-list
|
|---|
| 228 | .RS 4
|
|---|
| 229 | This option allows you to look at what services are available on a server\&. You use it as
|
|---|
| 230 | smbclient \-L host
|
|---|
| 231 | and a list should appear\&. The
|
|---|
| 232 | \fI\-I \fR
|
|---|
| 233 | option may be useful if your NetBIOS names don\*(Aqt match your TCP/IP DNS host names or if you are trying to reach a host on another network\&.
|
|---|
| 234 | .RE
|
|---|
| 235 | .PP
|
|---|
| 236 | \-b|\-\-send\-buffer buffersize
|
|---|
| 237 | .RS 4
|
|---|
| 238 | When sending or receiving files, smbclient uses an internal buffer sized by the maximum number of allowed requests to the connected server\&. This command allows this size to be set to any range between 0 (which means use the default server controlled size) bytes and 16776960 (0xFFFF00) bytes\&. Using the server controlled size is the most efficient as smbclient will pipeline as many simultaneous reads or writes needed to keep the server as busy as possible\&. Setting this to any other size will slow down the transfer\&. This can also be set using the
|
|---|
| 239 | iosize
|
|---|
| 240 | command inside smbclient\&.
|
|---|
| 241 | .RE
|
|---|
| 242 | .PP
|
|---|
| 243 | \-B|\-\-browse
|
|---|
| 244 | .RS 4
|
|---|
| 245 | Browse SMB servers using DNS\&.
|
|---|
| 246 | .RE
|
|---|
| 247 | .PP
|
|---|
| 248 | \-t|\-\-timeout <timeout\-seconds>
|
|---|
| 249 | .RS 4
|
|---|
| 250 | This allows the user to tune the default timeout used for each SMB request\&. The default setting is 20 seconds\&. Increase it if requests to the server sometimes time out\&. This can happen when SMB3 encryption is selected and smbclient is overwhelming the server with requests\&. This can also be set using the
|
|---|
| 251 | timeout
|
|---|
| 252 | command inside smbclient\&.
|
|---|
| 253 | .RE
|
|---|
| 254 | .PP
|
|---|
| 255 | \-T|\-\-tar tar options
|
|---|
| 256 | .RS 4
|
|---|
| 257 | smbclient may be used to create
|
|---|
| 258 | tar(1)
|
|---|
| 259 | compatible backups of all the files on an SMB/CIFS share\&. The secondary tar flags that can be given to this option are:
|
|---|
| 260 | .sp
|
|---|
| 261 | .RS 4
|
|---|
| 262 | .ie n \{\
|
|---|
| 263 | \h'-04'\(bu\h'+03'\c
|
|---|
| 264 | .\}
|
|---|
| 265 | .el \{\
|
|---|
| 266 | .sp -1
|
|---|
| 267 | .IP \(bu 2.3
|
|---|
| 268 | .\}
|
|---|
| 269 | \fIc\fR
|
|---|
| 270 | \- Create a tar backup archive on the local system\&. Must be followed by the name of a tar file, tape device or "\-" for standard output\&. If using standard output you must turn the log level to its lowest value \-d0 to avoid corrupting your tar file\&. This flag is mutually exclusive with the
|
|---|
| 271 | \fIx\fR
|
|---|
| 272 | flag\&.
|
|---|
| 273 | .RE
|
|---|
| 274 | .sp
|
|---|
| 275 | .RS 4
|
|---|
| 276 | .ie n \{\
|
|---|
| 277 | \h'-04'\(bu\h'+03'\c
|
|---|
| 278 | .\}
|
|---|
| 279 | .el \{\
|
|---|
| 280 | .sp -1
|
|---|
| 281 | .IP \(bu 2.3
|
|---|
| 282 | .\}
|
|---|
| 283 | \fIx\fR
|
|---|
| 284 | \- Extract (restore) a local tar file back to a share\&. Unless the \-D option is given, the tar files will be restored from the top level of the share\&. Must be followed by the name of the tar file, device or "\-" for standard input\&. Mutually exclusive with the
|
|---|
| 285 | \fIc\fR
|
|---|
| 286 | flag\&. Restored files have their creation times (mtime) set to the date saved in the tar file\&. Directories currently do not get their creation dates restored properly\&.
|
|---|
| 287 | .RE
|
|---|
| 288 | .sp
|
|---|
| 289 | .RS 4
|
|---|
| 290 | .ie n \{\
|
|---|
| 291 | \h'-04'\(bu\h'+03'\c
|
|---|
| 292 | .\}
|
|---|
| 293 | .el \{\
|
|---|
| 294 | .sp -1
|
|---|
| 295 | .IP \(bu 2.3
|
|---|
|
|---|