Advertisement
Guest User

Untitled

a guest
Feb 7th, 2019
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.56 KB | None | 0 0
  1. SMBCLIENT(1) User Commands SMBCLIENT(1)
  2.  
  3. NAME
  4. smbclient - ftp-like client to access SMB/CIFS resources on servers
  5.  
  6. SYNOPSIS
  7. smbclient [-b <buffer size>] [-d debuglevel] [-e] [-L <netbios name>] [-U username]
  8. [-I destinationIP] [-M <netbios name>] [-m maxprotocol] [-A authfile] [-N] [-C] [-g]
  9. [-i scope] [-O <socket options>] [-p port] [-R <name resolve order>] [-s <smb config file>]
  10. [-t <per-operation timeout in seconds>] [-k] [-P] [-c <command>]
  11.  
  12. smbclient {servicename} [password] [-b <buffer size>] [-d debuglevel] [-e] [-D Directory]
  13. [-U username] [-W workgroup] [-M <netbios name>] [-m maxprotocol] [-A authfile] [-N] [-C]
  14. [-g] [-l log-basename] [-I destinationIP] [-E] [-c <command string>] [-i scope]
  15. [-O <socket options>] [-p port] [-R <name resolve order>] [-s <smb config file>]
  16. [-t <per-operation timeout in seconds>] [-T<c|x>IXFqgbNan] [-k]
  17.  
  18. DESCRIPTION
  19. This tool is part of the samba(7) suite.
  20.  
  21. smbclient is a client that can 'talk' to an SMB/CIFS server. It offers an interface similar
  22. to that of the ftp program (see ftp(1)). Operations include things like getting files from
  23. the server to the local machine, putting files from the local machine to the server,
  24. retrieving directory information from the server and so on.
  25.  
  26. OPTIONS
  27. servicename
  28. servicename is the name of the service you want to use on the server. A service name
  29. takes the form //server/service where server is the NetBIOS name of the SMB/CIFS server
  30. offering the desired service and service is the name of the service offered. Thus to
  31. connect to the service "printer" on the SMB/CIFS server "smbserver", you would use the
  32. servicename //smbserver/printer
  33.  
  34. Note that the server name required is NOT necessarily the IP (DNS) host name of the
  35. server ! The name required is a NetBIOS server name, which may or may not be the same as
  36. the IP hostname of the machine running the server.
  37.  
  38. The server name is looked up according to either the -R parameter to smbclient or using
  39. the name resolve order parameter in the smb.conf(5) file, allowing an administrator to
  40. change the order and methods by which server names are looked up.
  41.  
  42. password
  43. The password required to access the specified service on the specified server. If this
  44. parameter is supplied, the -N option (suppress password prompt) is assumed.
  45.  
  46. There is no default password. If no password is supplied on the command line (either by
  47. using this parameter or adding a password to the -U option (see below)) and the -N option
  48. is not specified, the client will prompt for a password, even if the desired service does
  49. not require one. (If no password is required, simply press ENTER to provide a null
  50. password.)
  51.  
  52. Note: Some servers (including OS/2 and Windows for Workgroups) insist on an uppercase
  53. password. Lowercase or mixed case passwords may be rejected by these servers.
  54.  
  55. Be cautious about including passwords in scripts.
  56.  
  57. -R|--name-resolve <name resolve order>
  58. This option is used by the programs in the Samba suite to determine what naming services
  59. and in what order to resolve host names to IP addresses. The option takes a
  60. space-separated string of different name resolution options.
  61.  
  62. The options are :"lmhosts", "host", "wins" and "bcast". They cause names to be resolved
  63. as follows:
  64.  
  65. · lmhosts: Lookup an IP address in the Samba lmhosts file. If the line in
  66. lmhosts has no name type attached to the NetBIOS name (see the lmhosts(5) for
  67. details) then any name type matches for lookup.
  68.  
  69. · host: Do a standard host name to IP address resolution, using the system
  70. /etc/hosts, NIS, or DNS lookups. This method of name resolution is operating
  71. system dependent, for instance on IRIX or Solaris this may be controlled by
  72. the /etc/nsswitch.conf file). Note that this method is only used if the
  73. NetBIOS name type being queried is the 0x20 (server) name type, otherwise it
  74. is ignored.
  75.  
  76. · wins: Query a name with the IP address listed in the wins server parameter. If
  77. no WINS server has been specified this method will be ignored.
  78.  
  79. · bcast: Do a broadcast on each of the known local interfaces listed in the
  80. interfaces parameter. This is the least reliable of the name resolution
  81. methods as it depends on the target host being on a locally connected subnet.
  82.  
  83. If this parameter is not set then the name resolve order defined in the smb.conf(5) file
  84. parameter (name resolve order) will be used.
  85.  
  86. The default order is lmhosts, host, wins, bcast and without this parameter or any entry
  87. in the name resolve order parameter of the smb.conf(5) file the name resolution methods
  88. will be attempted in this order.
  89.  
  90. -M|--message NetBIOS name
  91. This options allows you to send messages, using the "WinPopup" protocol, to another
  92. computer. Once a connection is established you then type your message, pressing ^D
  93. (control-D) to end.
  94.  
  95. If the receiving computer is running WinPopup the user will receive the message and
  96. probably a beep. If they are not running WinPopup the message will be lost, and no error
  97. message will occur.
  98.  
  99. The message is also automatically truncated if the message is over 1600 bytes, as this is
  100. the limit of the protocol.
  101.  
  102. One useful trick is to pipe the message through smbclient. For example: smbclient -M FRED
  103. < mymessage.txt will send the message in the file mymessage.txt to the machine FRED.
  104.  
  105. You may also find the -U and -I options useful, as they allow you to control the FROM and
  106. TO parts of the message.
  107.  
  108. See the message command parameter in the smb.conf(5) for a description of how to handle
  109. incoming WinPopup messages in Samba.
  110.  
  111. Note: Copy WinPopup into the startup group on your WfWg PCs if you want them to always be
  112. able to receive messages.
  113.  
  114. -p|--port port
  115. This number is the TCP port number that will be used when making connections to the
  116. server. The standard (well-known) TCP port number for an SMB/CIFS server is 139, which is
  117. the default.
  118.  
  119. -g|--grepable
  120. This parameter provides combined with -L easy parseable output that allows processing
  121. with utilities such as grep and cut.
  122.  
  123. -m|--max-protocol protocol
  124. This allows the user to select the highest SMB protocol level that smbclient will use to
  125. connect to the server. By default this is set to NT1, which is the highest available SMB1
  126. protocol. To connect using SMB2 or SMB3 protocol, use the strings SMB2 or SMB3
  127. respectively. Note that to connect to a Windows 2012 server with encrypted transport
  128. selecting a max-protocol of SMB3 is required.
  129.  
  130. -P|--machine-pass
  131. Make queries to the external server using the machine account of the local server.
  132.  
  133. -I|--ip-address IP-address
  134. IP address is the address of the server to connect to. It should be specified in standard
  135. "a.b.c.d" notation.
  136.  
  137. Normally the client would attempt to locate a named SMB/CIFS server by looking it up via
  138. the NetBIOS name resolution mechanism described above in the name resolve order parameter
  139. above. Using this parameter will force the client to assume that the server is on the
  140. machine with the specified IP address and the NetBIOS name component of the resource
  141. being connected to will be ignored.
  142.  
  143. There is no default for this parameter. If not supplied, it will be determined
  144. automatically by the client as described above.
  145.  
  146. -E|--stderr
  147. This parameter causes the client to write messages to the standard error stream (stderr)
  148. rather than to the standard output stream.
  149.  
  150. By default, the client writes messages to standard output - typically the user's tty.
  151.  
  152. -L|--list
  153. This option allows you to look at what services are available on a server. You use it as
  154. smbclient -L host and a list should appear. The -I option may be useful if your NetBIOS
  155. names don't match your TCP/IP DNS host names or if you are trying to reach a host on
  156. another network.
  157.  
  158. -b|--send-buffer buffersize
  159. When sending or receiving files, smbclient uses an internal buffer sized by the maximum
  160. number of allowed requests to the connected server. This command allows this size to be
  161. set to any range between 0 (which means use the default server controlled size) bytes and
  162. 16776960 (0xFFFF00) bytes. Using the server controlled size is the most efficient as
  163. smbclient will pipeline as many simultaneous reads or writes needed to keep the server as
  164. busy as possible. Setting this to any other size will slow down the transfer. This can
  165. also be set using the iosize command inside smbclient.
  166.  
  167. -B|--browse
  168. Browse SMB servers using DNS.
  169.  
  170. -d|--debuglevel=level
  171. level is an integer from 0 to 10. The default value if this parameter is not specified is
  172. 1.
  173.  
  174. The higher this value, the more detail will be logged to the log files about the
  175. activities of the server. At level 0, only critical errors and serious warnings will be
  176. logged. Level 1 is a reasonable level for day-to-day running - it generates a small
  177. amount of information about operations carried out.
  178.  
  179. Levels above 1 will generate considerable amounts of log data, and should only be used
  180. when investigating a problem. Levels above 3 are designed for use only by developers and
  181. generate HUGE amounts of log data, most of which is extremely cryptic.
  182.  
  183. Note that specifying this parameter here will override the log level parameter in the
  184. smb.conf file.
  185.  
  186. -V|--version
  187. Prints the program version number.
  188.  
  189. -s|--configfile=<configuration file>
  190. The file specified contains the configuration details required by the server. The
  191. information in this file includes server-specific information such as what printcap file
  192. to use, as well as descriptions of all the services that the server is to provide. See
  193. smb.conf for more information. The default configuration file name is determined at
  194. compile time.
  195.  
  196. -l|--log-basename=logdirectory
  197. Base directory name for log/debug files. The extension ".progname" will be appended (e.g.
  198. log.smbclient, log.smbd, etc...). The log file is never removed by the client.
  199.  
  200. --option=<name>=<value>
  201. Set the smb.conf(5) option "<name>" to value "<value>" from the command line. This
  202. overrides compiled-in defaults and options read from the configuration file.
  203.  
  204. -N|--no-pass
  205. If specified, this parameter suppresses the normal password prompt from the client to the
  206. user. This is useful when accessing a service that does not require a password.
  207.  
  208. Unless a password is specified on the command line or this parameter is specified, the
  209. client will request a password.
  210.  
  211. If a password is specified on the command line and this option is also defined the
  212. password on the command line will be silently ingnored and no password will be used.
  213.  
  214. -k|--kerberos
  215. Try to authenticate with kerberos. Only useful in an Active Directory environment.
  216.  
  217. -C|--use-ccache
  218. Try to use the credentials cached by winbind.
  219.  
  220. -A|--authentication-file=filename
  221. This option allows you to specify a file from which to read the username and password
  222. used in the connection. The format of the file is
  223.  
  224. username = <value>
  225. password = <value>
  226. domain = <value>
  227.  
  228. Make certain that the permissions on the file restrict access from unwanted users.
  229.  
  230. -U|--user=username[%password]
  231. Sets the SMB username or username and password.
  232.  
  233. If %password is not specified, the user will be prompted. The client will first check the
  234. USER environment variable, then the LOGNAME variable and if either exists, the string is
  235. uppercased. If these environmental variables are not found, the username GUEST is used.
  236.  
  237. A third option is to use a credentials file which contains the plaintext of the username
  238. and password. This option is mainly provided for scripts where the admin does not wish to
  239. pass the credentials on the command line or via environment variables. If this method is
  240. used, make certain that the permissions on the file restrict access from unwanted users.
  241. See the -A for more details.
  242.  
  243. Be cautious about including passwords in scripts. Also, on many systems the command line
  244. of a running process may be seen via the ps command. To be safe always allow rpcclient to
  245. prompt for a password and type it in directly.
  246.  
  247. -S|--signing on|off|required
  248. Set the client signing state.
  249.  
  250. -P|--machine-pass
  251. Use stored machine account password.
  252.  
  253. -e|--encrypt
  254. This command line parameter requires the remote server support the UNIX extensions or
  255. that the SMB3 protocol has been selected. Requests that the connection be encrypted.
  256. Negotiates SMB encryption using either SMB3 or POSIX extensions via GSSAPI. Uses the
  257. given credentials for the encryption negotiation (either kerberos or NTLMv1/v2 if given
  258. domain/username/password triple. Fails the connection if encryption cannot be negotiated.
  259.  
  260. --pw-nt-hash
  261. The supplied password is the NT hash.
  262.  
  263. -n|--netbiosname <primary NetBIOS name>
  264. This option allows you to override the NetBIOS name that Samba uses for itself. This is
  265. identical to setting the netbios name parameter in the smb.conf file. However, a command
  266. line setting will take precedence over settings in smb.conf.
  267.  
  268. -i|--scope <scope>
  269. This specifies a NetBIOS scope that nmblookup will use to communicate with when
  270. generating NetBIOS names. For details on the use of NetBIOS scopes, see rfc1001.txt and
  271. rfc1002.txt. NetBIOS scopes are very rarely used, only set this parameter if you are the
  272. system administrator in charge of all the NetBIOS systems you communicate with.
  273.  
  274. -W|--workgroup=domain
  275. Set the SMB domain of the username. This overrides the default domain which is the domain
  276. defined in smb.conf. If the domain specified is the same as the servers NetBIOS name, it
  277. causes the client to log on using the servers local SAM (as opposed to the Domain SAM).
  278.  
  279. -O|--socket-options socket options
  280. TCP socket options to set on the client socket. See the socket options parameter in the
  281. smb.conf manual page for the list of valid options.
  282.  
  283. -?|--help
  284. Print a summary of command line options.
  285.  
  286. --usage
  287. Display brief usage message.
  288.  
  289. -t|--timeout <timeout-seconds>
  290. This allows the user to tune the default timeout used for each SMB request. The default
  291. setting is 20 seconds. Increase it if requests to the server sometimes time out. This can
  292. happen when SMB3 encryption is selected and smbclient is overwhelming the server with
  293. requests. This can also be set using the timeout command inside smbclient.
  294.  
  295. -T|--tar tar options
  296. smbclient may be used to create tar(1) compatible backups of all the files on an SMB/CIFS
  297. share. The secondary tar flags that can be given to this option are:
  298.  
  299. · c - Create a tar backup archive on the local system. Must be followed by the
  300. name of a tar file, tape device or "-" for standard output. If using standard
  301. output you must turn the log level to its lowest value -d0 to avoid corrupting
  302. your tar file. This flag is mutually exclusive with the x flag.
  303.  
  304. · x - Extract (restore) a local tar file back to a share. Unless the -D option
  305. is given, the tar files will be restored from the top level of the share. Must
  306. be followed by the name of the tar file, device or "-" for standard input.
  307. Mutually exclusive with the c flag. Restored files have their creation times
  308. (mtime) set to the date saved in the tar file. Directories currently do not
  309. get their creation dates restored properly.
  310.  
  311. · I - Include files and directories. Is the default behavior when filenames are
  312. specified above. Causes files to be included in an extract or create (and
  313. therefore everything else to be excluded). See example below. Filename
  314. globbing works in one of two ways. See r below.
  315.  
  316. · X - Exclude files and directories. Causes files to be excluded from an extract
  317. or create. See example below. Filename globbing works in one of two ways. See
  318. r below.
  319.  
  320. · F - File containing a list of files and directories. The F causes the name
  321. following the tarfile to create to be read as a filename that contains a list
  322. of files and directories to be included in an extract or create (and therefore
  323. everything else to be excluded). See example below. Filename globbing works in
  324. one of two ways. See r below.
  325.  
  326. · b - Blocksize. Must be followed by a valid (greater than zero) blocksize.
  327. Causes tar file to be written out in blocksize*TBLOCK (512 byte) blocks.
  328.  
  329. · g - Incremental. Only back up files that have the archive bit set. Useful only
  330. with the c flag.
  331.  
  332. · q - Quiet. Keeps tar from printing diagnostics as it works. This is the same
  333. as tarmode quiet.
  334.  
  335. · r - Use wildcard matching to include or exclude. Deprecated.
  336.  
  337. · N - Newer than. Must be followed by the name of a file whose date is compared
  338. against files found on the share during a create. Only files newer than the
  339. file specified are backed up to the tar file. Useful only with the c flag.
  340.  
  341. · a - Set archive bit. Causes the archive bit to be reset when a file is backed
  342. up. Useful with the g and c flags.
  343.  
  344. Tar Long File Names
  345.  
  346. smbclient's tar option now supports long file names both on backup and restore. However,
  347. the full path name of the file must be less than 1024 bytes. Also, when a tar archive is
  348. created, smbclient's tar option places all files in the archive with relative names, not
  349. absolute names.
  350.  
  351. Tar Filenames
  352.  
  353. All file names can be given as DOS path names (with '\\' as the component separator) or
  354. as UNIX path names (with '/' as the component separator).
  355.  
  356. Examples
  357.  
  358. Restore from tar file backup.tar into myshare on mypc (no password on share).
  359.  
  360. smbclient //mypc/myshare "" -N -Tx backup.tar
  361.  
  362. Restore everything except users/docs
  363.  
  364. smbclient //mypc/myshare "" -N -TXx backup.tar users/docs
  365.  
  366. Create a tar file of the files beneath users/docs.
  367.  
  368. smbclient //mypc/myshare "" -N -Tc backup.tar users/docs
  369.  
  370. Create the same tar file as above, but now use a DOS path name.
  371.  
  372. smbclient //mypc/myshare "" -N -Tc backup.tar users\edocs
  373.  
  374. Create a tar file of the files listed in the file tarlist.
  375.  
  376. smbclient //mypc/myshare "" -N -TcF backup.tar tarlist
  377.  
  378. Create a tar file of all the files and directories in the share.
  379.  
  380. smbclient //mypc/myshare "" -N -Tc backup.tar *
  381.  
  382. -D|--directory initial directory
  383. Change to initial directory before starting. Probably only of any use with the tar -T
  384. option.
  385.  
  386. -c|--command command string
  387. command string is a semicolon-separated list of commands to be executed instead of
  388. prompting from stdin.
  389. -N is implied by -c.
  390.  
  391. This is particularly useful in scripts and for printing stdin to the server, e.g. -c
  392. 'print -'.
  393.  
  394. OPERATIONS
  395. Once the client is running, the user is presented with a prompt :
  396.  
  397. smb:\>
  398.  
  399. The backslash ("\\") indicates the current working directory on the server, and will change
  400. if the current working directory is changed.
  401.  
  402. The prompt indicates that the client is ready and waiting to carry out a user command. Each
  403. command is a single word, optionally followed by parameters specific to that command. Command
  404. and parameters are space-delimited unless these notes specifically state otherwise. All
  405. commands are case-insensitive. Parameters to commands may or may not be case sensitive,
  406. depending on the command.
  407.  
  408. You can specify file names which have spaces in them by quoting the name with double quotes,
  409. for example "a long file name".
  410.  
  411. Parameters shown in square brackets (e.g., "[parameter]") are optional. If not given, the
  412. command will use suitable defaults. Parameters shown in angle brackets (e.g., "<parameter>")
  413. are required.
  414.  
  415. Note that all commands operating on the server are actually performed by issuing a request to
  416. the server. Thus the behavior may vary from server to server, depending on how the server was
  417. implemented.
  418.  
  419. The commands available are given here in alphabetical order.
  420.  
  421. ? [command]
  422. If command is specified, the ? command will display a brief informative message about the
  423. specified command. If no command is specified, a list of available commands will be
  424. displayed.
  425.  
  426. ! [shell command]
  427. If shell command is specified, the ! command will execute a shell locally and run the
  428. specified shell command. If no command is specified, a local shell will be run.
  429.  
  430. allinfo file
  431. The client will request that the server return all known information about a file or
  432. directory (including streams).
  433.  
  434. altname file
  435. The client will request that the server return the "alternate" name (the 8.3 name) for a
  436. file or directory.
  437.  
  438. archive <number>
  439. Sets the archive level when operating on files. 0 means ignore the archive bit, 1 means
  440. only operate on files with this bit set, 2 means only operate on files with this bit set
  441. and reset it after operation, 3 means operate on all files and reset it after operation.
  442. The default is 0.
  443.  
  444. backup
  445. Toggle the state of the "backup intent" flag sent to the server on directory listings and
  446. file opens. If the "backup intent" flag is true, the server will try and bypass some file
  447. system checks if the user has been granted SE_BACKUP or SE_RESTORE privileges. This state
  448. is useful when performing a backup or restore operation.
  449.  
  450. blocksize <number>
  451. Sets the blocksize parameter for a tar operation. The default is 20. Causes tar file to
  452. be written out in blocksize*TBLOCK (normally 512 byte) units.
  453.  
  454. cancel jobid0 [jobid1] ... [jobidN]
  455. The client will request that the server cancel the printjobs identified by the given
  456. numeric print job ids.
  457.  
  458. case_sensitive
  459. Toggles the setting of the flag in SMB packets that tells the server to treat filenames
  460. as case sensitive. Set to OFF by default (tells file server to treat filenames as case
  461. insensitive). Only currently affects Samba 3.0.5 and above file servers with the case
  462. sensitive parameter set to auto in the smb.conf.
  463.  
  464. cd <directory name>
  465. If "directory name" is specified, the current working directory on the server will be
  466. changed to the directory specified. This operation will fail if for any reason the
  467. specified directory is inaccessible.
  468.  
  469. If no directory name is specified, the current working directory on the server will be
  470. reported.
  471.  
  472. chmod file mode in octal
  473. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  474. the server does not. The client requests that the server change the UNIX permissions to
  475. the given octal mode, in standard UNIX format.
  476.  
  477. chown file uid gid
  478. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  479. the server does not. The client requests that the server change the UNIX user and group
  480. ownership to the given decimal values. Note there is currently no way to remotely look up
  481. the UNIX uid and gid values for a given name. This may be addressed in future versions of
  482. the CIFS UNIX extensions.
  483.  
  484. close <fileid>
  485. Closes a file explicitly opened by the open command. Used for internal Samba testing
  486. purposes.
  487.  
  488. del <mask>
  489. The client will request that the server attempt to delete all files matching mask from
  490. the current working directory on the server.
  491.  
  492. deltree <mask>
  493. The client will request that the server attempt to delete all files and directories
  494. matching mask from the current working directory on the server. Note this will
  495. recursively delete files and directories within the directories selected even without the
  496. recurse command being set. If any of the delete requests fail the command will stop
  497. processing at that point, leaving files and directories not yet processed untouched. This
  498. is by design.
  499.  
  500. dir <mask>
  501. A list of the files matching mask in the current working directory on the server will be
  502. retrieved from the server and displayed.
  503.  
  504. du <filename>
  505. Does a directory listing and then prints out the current disk usage and free space on a
  506. share.
  507.  
  508. echo <number> <data>
  509. Does an SMBecho request to ping the server. Used for internal Samba testing purposes.
  510.  
  511. exit
  512. Terminate the connection with the server and exit from the program.
  513.  
  514. get <remote file name> [local file name]
  515. Copy the file called remote file name from the server to the machine running the client.
  516. If specified, name the local copy local file name. Note that all transfers in smbclient
  517. are binary. See also the lowercase command.
  518.  
  519. getfacl <filename>
  520. Requires the server support the UNIX extensions. Requests and prints the POSIX ACL on a
  521. file.
  522.  
  523. hardlink <src> <dest>
  524. Creates a hardlink on the server using Windows CIFS semantics.
  525.  
  526. help [command]
  527. See the ? command above.
  528.  
  529. history
  530. Displays the command history.
  531.  
  532. iosize <bytes>
  533. When sending or receiving files, smbclient uses an internal buffer sized by the maximum
  534. number of allowed requests to the connected server. This command allows this size to be
  535. set to any range between 0 (which means use the default server controlled size) bytes and
  536. 16776960 (0xFFFF00) bytes. Using the server controlled size is the most efficient as
  537. smbclient will pipeline as many simultaneous reads or writes needed to keep the server as
  538. busy as possible. Setting this to any other size will slow down the transfer.
  539.  
  540. lcd [directory name]
  541. If directory name is specified, the current working directory on the local machine will
  542. be changed to the directory specified. This operation will fail if for any reason the
  543. specified directory is inaccessible.
  544.  
  545. If no directory name is specified, the name of the current working directory on the local
  546. machine will be reported.
  547.  
  548. link target linkname
  549. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  550. the server does not. The client requests that the server create a hard link between the
  551. linkname and target files. The linkname file must not exist.
  552.  
  553. listconnect
  554. Show the current connections held for DFS purposes.
  555.  
  556. lock <filenum> <r|w> <hex-start> <hex-len>
  557. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  558. the server does not. Tries to set a POSIX fcntl lock of the given type on the given
  559. range. Used for internal Samba testing purposes.
  560.  
  561. logon <username> <password>
  562. Establishes a new vuid for this session by logging on again. Replaces the current vuid.
  563. Prints out the new vuid. Used for internal Samba testing purposes.
  564.  
  565. logoff
  566. Logs the user off the server, closing the session. Used for internal Samba testing
  567. purposes.
  568.  
  569. lowercase
  570. Toggle lowercasing of filenames for the get and mget commands.
  571.  
  572. When lowercasing is toggled ON, local filenames are converted to lowercase when using the
  573. get and mget commands. This is often useful when copying (say) MSDOS files from a server,
  574. because lowercase filenames are the norm on UNIX systems.
  575.  
  576. ls <mask>
  577. See the dir command above.
  578.  
  579. mask <mask>
  580. This command allows the user to set up a mask which will be used during recursive
  581. operation of the mget and mput commands.
  582.  
  583. The masks specified to the mget and mput commands act as filters for directories rather
  584. than files when recursion is toggled ON.
  585.  
  586. The mask specified with the mask command is necessary to filter files within those
  587. directories. For example, if the mask specified in an mget command is "source*" and the
  588. mask specified with the mask command is "*.c" and recursion is toggled ON, the mget
  589. command will retrieve all files matching "*.c" in all directories below and including all
  590. directories matching "source*" in the current working directory.
  591.  
  592. Note that the value for mask defaults to blank (equivalent to "*") and remains so until
  593. the mask command is used to change it. It retains the most recently specified value
  594. indefinitely. To avoid unexpected results it would be wise to change the value of mask
  595. back to "*" after using the mget or mput commands.
  596.  
  597. md <directory name>
  598. See the mkdir command.
  599.  
  600. mget <mask>
  601. Copy all files matching mask from the server to the machine running the client.
  602.  
  603. Note that mask is interpreted differently during recursive operation and non-recursive
  604. operation - refer to the recurse and mask commands for more information. Note that all
  605. transfers in smbclient are binary. See also the lowercase command.
  606.  
  607. mkdir <directory name>
  608. Create a new directory on the server (user access privileges permitting) with the
  609. specified name.
  610.  
  611. more <file name>
  612. Fetch a remote file and view it with the contents of your PAGER environment variable.
  613.  
  614. mput <mask>
  615. Copy all files matching mask in the current working directory on the local machine to the
  616. current working directory on the server.
  617.  
  618. Note that mask is interpreted differently during recursive operation and non-recursive
  619. operation - refer to the recurse and mask commands for more information. Note that all
  620. transfers in smbclient are binary.
  621.  
  622. notify <dir name>
  623. Query a directory for change notifications. This command issues a recursive
  624. filechangenotify call for all possible changes. As changes come in will print one line
  625. per change. See https://msdn.microsoft.com/en-us/library/dn392331.aspx for a description
  626. of the action numbers that this command prints.
  627.  
  628. This command never ends, it waits for event indefinitely.
  629.  
  630. posix
  631. Query the remote server to see if it supports the CIFS UNIX extensions and prints out the
  632. list of capabilities supported. If so, turn on POSIX pathname processing and large file
  633. read/writes (if available),.
  634.  
  635. posix_encrypt <domain> <username> <password>
  636. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  637. the server does not. Attempt to negotiate SMB encryption on this connection. If smbclient
  638. connected with kerberos credentials (-k) the arguments to this command are ignored and
  639. the kerberos credentials are used to negotiate GSSAPI signing and sealing instead. See
  640. also the -e option to smbclient to force encryption on initial connection. This command
  641. is new with Samba 3.2.
  642.  
  643. posix_open <filename> <octal mode>
  644. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  645. the server does not. Opens a remote file using the CIFS UNIX extensions and prints a
  646. fileid. Used for internal Samba testing purposes.
  647.  
  648. posix_mkdir <directoryname> <octal mode>
  649. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  650. the server does not. Creates a remote directory using the CIFS UNIX extensions with the
  651. given mode.
  652.  
  653. posix_rmdir <directoryname>
  654. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  655. the server does not. Deletes a remote directory using the CIFS UNIX extensions.
  656.  
  657. posix_unlink <filename>
  658. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  659. the server does not. Deletes a remote file using the CIFS UNIX extensions.
  660.  
  661. posix_whoami
  662. Query the remote server for the user token using the CIFS UNIX extensions WHOAMI call.
  663. Prints out the guest status, user, group, group list and sid list that the remote server
  664. is using on behalf of the logged on user.
  665.  
  666. print <file name>
  667. Print the specified file from the local machine through a printable service on the
  668. server.
  669.  
  670. prompt
  671. Toggle prompting for filenames during operation of the mget and mput commands.
  672.  
  673. When toggled ON, the user will be prompted to confirm the transfer of each file during
  674. these commands. When toggled OFF, all specified files will be transferred without
  675. prompting.
  676.  
  677. put <local file name> [remote file name]
  678. Copy the file called local file name from the machine running the client to the server.
  679. If specified, name the remote copy remote file name. Note that all transfers in smbclient
  680. are binary. See also the lowercase command.
  681.  
  682. queue
  683. Displays the print queue, showing the job id, name, size and current status.
  684.  
  685. quit
  686. See the exit command.
  687.  
  688. readlink symlinkname
  689. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  690. the server does not. Print the value of the symlink "symlinkname".
  691.  
  692. rd <directory name>
  693. See the rmdir command.
  694.  
  695. recurse
  696. Toggle directory recursion for the commands mget and mput.
  697.  
  698. When toggled ON, these commands will process all directories in the source directory
  699. (i.e., the directory they are copying from ) and will recurse into any that match the
  700. mask specified to the command. Only files that match the mask specified using the mask
  701. command will be retrieved. See also the mask command.
  702.  
  703. When recursion is toggled OFF, only files from the current working directory on the
  704. source machine that match the mask specified to the mget or mput commands will be copied,
  705. and any mask specified using the mask command will be ignored.
  706.  
  707. rename <old filename> <new filename> [-f]
  708. Rename files in the current working directory on the server from old filename to new
  709. filename. The optional -f switch allows for superseding the destination file, if it
  710. exists. This is supported by NT1 protocol dialect and SMB2 protocol family.
  711.  
  712. rm <mask>
  713. Remove all files matching mask from the current working directory on the server.
  714.  
  715. rmdir <directory name>
  716. Remove the specified directory (user access privileges permitting) from the server.
  717.  
  718. scopy <source filename> <destination filename>
  719. Attempt to copy a file on the server using the most efficient server-side copy calls.
  720. Falls back to using read then write if server doesn't support server-side copy.
  721.  
  722. setmode <filename> <perm=[+|\-]rsha>
  723. A version of the DOS attrib command to set file permissions. For example:
  724.  
  725. setmode myfile +r
  726.  
  727. would make myfile read only.
  728.  
  729. showconnect
  730. Show the currently active connection held for DFS purposes.
  731.  
  732. stat file
  733. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  734. the server does not. The client requests the UNIX basic info level and prints out the
  735. same info that the Linux stat command would about the file. This includes the size,
  736. blocks used on disk, file type, permissions, inode number, number of links and finally
  737. the three timestamps (access, modify and change). If the file is a special file (symlink,
  738. character or block device, fifo or socket) then extra information may also be printed.
  739.  
  740. symlink target linkname
  741. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  742. the server does not. The client requests that the server create a symbolic hard link
  743. between the target and linkname files. The linkname file must not exist. Note that the
  744. server will not create a link to any path that lies outside the currently connected
  745. share. This is enforced by the Samba server.
  746.  
  747. tar <c|x>[IXbgNa]
  748. Performs a tar operation - see the -T command line option above. Behavior may be affected
  749. by the tarmode command (see below). Using g (incremental) and N (newer) will affect
  750. tarmode settings. Note that using the "-" option with tar x may not work - use the
  751. command line option instead.
  752.  
  753. blocksize <blocksize>
  754. Blocksize. Must be followed by a valid (greater than zero) blocksize. Causes tar file to
  755. be written out in blocksize*TBLOCK (512 byte) blocks.
  756.  
  757. tarmode <full|inc|reset|noreset|system|nosystem|hidden|nohidden>
  758. Changes tar's behavior with regard to DOS attributes. There are 4 modes which can be
  759. turned on or off.
  760.  
  761. Incremental mode (default off). When off (using full) tar will back up everything
  762. regardless of the archive bit setting. When on (using inc), tar will only back up files
  763. with the archive bit set.
  764.  
  765. Reset mode (default off). When on (using reset), tar will remove the archive bit on all
  766. files it backs up (implies read/write share). Use noreset to turn off.
  767.  
  768. System mode (default on). When off, tar will not backup system files. Use nosystem to
  769. turn off.
  770.  
  771. Hidden mode (default on). When off, tar will not backup hidden files. Use nohidden to
  772. turn off.
  773.  
  774. timeout <per-operation timeout in seconds>
  775. This allows the user to tune the default timeout used for each SMB request. The default
  776. setting is 20 seconds. Increase it if requests to the server sometimes time out. This can
  777. happen when SMB3 encryption is selected and smbclient is overwhelming the server with
  778. requests.
  779.  
  780. unlock <filenum> <hex-start> <hex-len>
  781. This command depends on the server supporting the CIFS UNIX extensions and will fail if
  782. the server does not. Tries to unlock a POSIX fcntl lock on the given range. Used for
  783. internal Samba testing purposes.
  784.  
  785. volume
  786. Prints the current volume name of the share.
  787.  
  788. vuid <number>
  789. Changes the currently used vuid in the protocol to the given arbitrary number. Without an
  790. argument prints out the current vuid being used. Used for internal Samba testing
  791. purposes.
  792.  
  793. tcon <sharename>
  794. Establishes a new tree connect (connection to a share). Replaces the current tree
  795. connect. Prints the new tid (tree id). Used for internal Samba testing purposes.
  796.  
  797. tdis
  798. Close the current share connection (tree disconnect). Used for internal Samba testing
  799. purposes.
  800.  
  801. tid <number>
  802. Changes the current tree id (tid) in the protocol to a new arbitrary number. Without an
  803. argument, it prints out the tid currently used. Used for internal Samba testing purposes.
  804.  
  805. utimes <filename> <create time> <access time> <write time> < change time>
  806. Changes the timestamps on a file by name. Times should be specified in the format
  807. YY:MM:DD-HH:MM:SS or -1 for no change.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement