preparing for release of alpha.1.1
[Samba.git] / docs / textdocs / rpcclient.1.txt
blobfde9438b33a131106f008893e1de1bada981fa76
1 !==
2 !== rpcclient.1.txt for Samba release TNG-prealpha 19 Mar 2000
3 !==
5 TITLE INFORMATION: rpcclient (1) 
6 AUTHOR INFORMATION: Samba SAMBA 
7 DATE INFORMATION: 23 Oct 1998 
9 NAME
10 rpcclient - utility to manage MSRPC resources on servers
12 SYNOPSIS
14 rpcclient
15 [password]
16 -S servername
17 [-U [username][%][password]]
18 [-W domain]
19 [-l log basename]
20 [-d debuglevel]
21 [-O socket options]
22 [-i scope]
23 [-N]
24 [-n NetBIOS name]
25 [-h]
26 [-I dest IP]
27 [-E]
28 [-t terminal code]
29 [-c command string]
30 [-B IP addr]
31 [-s smb.conf]
32 [-m max protocol]
34 DESCRIPTION
36 This program is part of the Samba suite.
38 rpcclient is a client that can 'talk' to an SMB/CIFS MSRPC server.
39 Operations include things like managing a SAM Database (users, groups
40 and aliases) in the same way as the Windows NT programs
41 User Manager for Domains and Server Manager for Domains;
42 managing a remote registry in the same way as the Windows NT programs
43 REGEDT32.EXE and REGEDIT.EXE; viewing a remote event log (same
44 as EVENTVWR.EXE) etc.
46 Typical usage is like this: 
48 rpcclient -I 192.168.32.1 -S "*SMBSERVER" -U fred%secret -l log
50 OPTIONS
52 o servername servername is the name of the server you want
53 to use on the server.  This should be the NetBIOS name of the SMB/CIFS
54 server, which can be *SMBSERVER on Windows NT 4.0 or Samba Servers.
56 Note that the server name required is NOT necessarily the IP (DNS)
57 host name of the server! The name required is a NetBIOS server name,
58 which may or may not be the same as the IP hostname of the machine
59 running the server.  Also, remember that having a period in a NetBIOS
60 name (such as an IP hostname) may cause connectivity problems on your
61 network: NT tends to strip NetBIOS names from the leading period
62 onwards.
64 The server name is looked up according to either the
65 -R parameter to rpcclient or using the
66 name resolve order
67 parameter in the smb.conf file, allowing an administrator to change
68 the order and methods by which server names are looked up.
70 o password password is the password required to access the
71 specified service on the specified server. If this parameter is
72 supplied, the -N option (suppress password prompt) is assumed.
74 There is no default password. If no password is supplied on the
75 command line (either by using this parameter or adding a password to
76 the -U option (see below)) and the -N option is not specified,
77 the client will prompt for a password, even if the desired service
78 does not require one. (If no password is required, simply press ENTER
79 to provide a null password.)
81 Note: Some servers (including OS/2 and Windows for Workgroups) insist
82 on an uppercase password. Lowercase or mixed case passwords may be
83 rejected by these servers.
85 Be cautious about including passwords in scripts.
87 o -s smb.conf This parameter specifies the pathname to the
88 Samba configuration file, smb.conf. This file controls all aspects of
89 the Samba setup on the machine and rpcclient also needs to read this
90 file.
92 o -B IP addr The IP address to use when sending a broadcast packet.
94 o -O socket options TCP socket options to set on the client
95 socket. See the socket options
96 parameter in the smb.conf (5) manpage for
97 the list of valid options.
99 o -R name resolve order This option allows the user of
100 rpcclient to determine what name resolution services to use when
101 looking up the NetBIOS name of the host being connected to.
103 The options are :"lmhosts", "host", "wins" and "bcast". They cause
104 names to be resolved as follows :
106 o  lmhosts : Lookup an IP address in the Samba lmhosts file.
107 The lmhosts file is stored in the same directory as the
108 smb.conf file.
110 o  host : Do a standard host name to IP address resolution,
111 using the system /etc/hosts, NIS, or DNS lookups. This method of name
112 resolution is operating system depended for instance on IRIX or
113 Solaris this may be controlled by the /etc/nsswitch.conf file).  
115 o  wins : Query a name with the IP address listed in the wins
116 server parameter in the smb.conf file. If 
117 no WINS server has been specified this method will be ignored.
119 o  bcast : Do a broadcast on each of the known local interfaces
120 listed in the interfaces parameter
121 in the smb.conf file. This is the least reliable of the name resolution
122 methods as it depends on the target host being on a locally connected
123 subnet. To specify a particular broadcast address the -B option 
124 may be used.
126 If this parameter is not set then the name resolve order defined
127 in the smb.conf file parameter 
128 (name resolve order)
129 will be used.
131 The default order is lmhosts, host, wins, bcast and without this
132 parameter or any entry in the "name resolve
133 order" parameter of the
134 smb.conf file the name resolution methods
135 will be attempted in this order.
137 o -i scope This specifies a NetBIOS scope that rpcclient will use
138 to communicate with when generating NetBIOS names. For details on the
139 use of NetBIOS scopes, see rfc1001.txt and rfc1002.txt. NetBIOS scopes
140 are very rarely used, only set this parameter if you are the
141 system administrator in charge of all the NetBIOS systems you
142 communicate with.
144 o -N If specified, this parameter suppresses the normal
145 password prompt from the client to the user. This is useful when
146 accessing a service that does not require a password.
148 Unless a password is specified on the command line or this parameter
149 is specified, the client will request a password.
151 o -n NetBIOS name By default, the client will use the local
152 machine's hostname (in uppercase) as its NetBIOS name. This parameter
153 allows you to override the host name and use whatever NetBIOS name you
154 wish.
156 o -d debuglevel debuglevel is an integer from 0 to 10, or the
157 letter 'A'.
159 The default value if this parameter is not specified is zero.
161 The higher this value, the more detail will be logged to the log files
162 about the activities of the client. At level 0, only critical errors
163 and serious warnings will be logged. Level 1 is a reasonable level for
164 day to day running - it generates a small amount of information about
165 operations carried out.
167 Levels above 1 will generate considerable amounts of log data, and
168 should only be used when investigating a problem. Levels above 3 are
169 designed for use only by developers and generate HUGE amounts of log
170 data, most of which is extremely cryptic. If debuglevel is set to the
171 letter 'A', then all debug messages will be printed. This setting
172 is for developers only (and people who really want to know how the
173 code works internally).
175 Note that specifying this parameter here will override the log
176 level parameter in the smb.conf
177 (5) file.
179 o -p port This number is the TCP port number that will be used
180 when making connections to the server. The standard (well-known) TCP
181 port number for an SMB/CIFS server is 139, which is the default.
183 o -l logfilename If specified, logfilename specifies a base
184 filename into which operational data from the running client will be
185 logged.
187 The default base name is specified at compile time.
189 The base name is used to generate actual log file names. For example,
190 if the name specified was "log", the debug file would be
191 log.client.
193 The log file generated is never removed by the client.
195 o -h Print the usage message for the client.
197 o -I IP address IP address is the address of the server to
198 connect to. It should be specified in standard "a.b.c.d" notation.
200 Normally the client would attempt to locate a named SMB/CIFS server by
201 looking it up via the NetBIOS name resolution mechanism described
202 above in the name resolve order parameter
203 above. Using this parameter will force the client to assume that the
204 server is on the machine with the specified IP address and the NetBIOS
205 name component of the resource being connected to will be ignored.
207 There is no default for this parameter. If not supplied, it will be
208 determined automatically by the client as described above.
210 o -E This parameter causes the client to write messages to the
211 standard error stream (stderr) rather than to the standard output
212 stream.
214 By default, the client writes messages to standard output - typically
215 the user's tty.
217 Note that by default, debug information is always sent to stderr.
218 Debug information can instead be sent to a file, using the
219 -l log basename option.
221 o -U username This specifies the user name that will be used by
222 the client to make a connection, assuming your server is not a downlevel
223 server that is running a protocol level that uses passwords on shares,
224 not on usernames.
226 Some servers are fussy about the case of this name, and some insist
227 that it must be a valid NetBIOS name.
229 If no username is supplied, it will default to an uppercase version of
230 the environment variable USER or LOGNAME in that order.  If no
231 username is supplied and neither environment variable exists the
232 username "GUEST" will be used.
234 If the USER environment variable contains a '%' character,
235 everything after that will be treated as a password. This allows you
236 to set the environment variable to be USER=username%password so
237 that a password is not passed on the command line (where it may be
238 seen by the ps command).
240 If the service you are connecting to requires a password, it can be
241 supplied using the -U option, by appending a percent symbol ("%")
242 then the password to username.  For example, to attach to a service as
243 user "fred" with password "secret", you would specify. 
245 -U fred%secret 
247 on the command line. Note that there are no spaces around the percent
248 symbol.
250 If you specify the password as part of username then the -N option
251 (suppress password prompt) is assumed.
253 If you specify the password as a parameter AND as part of username
254 then the password as part of username will take precedence. Putting
255 nothing before or nothing after the percent symbol will cause an empty
256 username or an empty password to be used, respectively.
258 The password may also be specified by setting up an environment
259 variable called PASSWORD that contains the users password. Note
260 that this may be very insecure on some systems but on others allows
261 users to script rpcclient commands without having a password appear in
262 the command line of a process listing.
264 Note: Some servers (including OS/2 and Windows for Workgroups) insist
265 on an uppercase password. Lowercase or mixed case passwords may be
266 rejected by these servers.
268 Be cautious about including passwords in scripts or in the
269 PASSWORD environment variable. Also, on many systems the command
270 line of a running process may be seen via the ps command to be
271 safe always allow rpcclient to prompt for a password and type it in
272 directly.
274 o -t terminal code This option tells rpcclient how to interpret
275 filenames coming from the remote server. Usually Asian language
276 multibyte UNIX implementations use different character sets than
277 SMB/CIFS servers (EUC instead of SJIS for example). Setting
278 this parameter will let rpcclient convert between the UNIX filenames
279 and the SMB filenames correctly. This option has not been seriously
280 tested and may have some problems.
282 The terminal codes include sjis, euc, jis7, jis8,
283 junet, hex, cap. This is not a complete list, check the
284 Samba source code for the complete list.
286 o -m max protocol level With the new code in Samba2.0,
287 rpcclient always attempts to connect at the maximum
288 protocols level the server supports. This parameter is
289 preserved for backwards compatibility, but any string
290 following the -m will be ignored.
292 o -W Domain Override the default Domain, which is the remote server's
293 Domain.  This option may be needed to connect to some servers.  It is also
294 possible to specify the remote server name as the Domain, which will
295 force the username and password to be authenticated against the remote
296 server's local SAM instead of the Domain SAM.
298 o -c command string command string is a semicolon separated
299 list of commands to be executed instead of prompting from stdin.
300 -N is implied by -c.
302 This is particularly useful in scripts, e.g. -c 'lsaquery; enumusers -u'.
304 OPERATIONS
306 Once the client is running, the user is presented with a prompt :
308 smb:\>
310 The prompt indicates that the client is ready and waiting to carry out
311 a user command. Each command is a single word, optionally followed by
312 parameters specific to that command. Command and parameters are
313 space-delimited unless these notes specifically state otherwise. All
314 commands are case-insensitive.  Parameters to commands may or may not
315 be case sensitive, depending on the command.
317 You can specify names (e.g registry keys; user or group names;
318 service names) which have spaces in them by quoting the
319 name with double quotes, for example "dRMON SmartAgent".
321 Parameters shown in square brackets (e.g., "[parameter]") are
322 optional. If not given, the command will use suitable
323 defaults. Parameters shown in angle brackets (e.g., "<parameter>") are
324 required.
326 Note that all commands operating on the server are actually performed
327 by issuing a request to the server. Thus the behavior may vary from
328 server to server, depending on how the server was implemented.
330 The commands available are listed in groups relating to different services:
332 o Misccellaneous
334                 o ? [command] If "command" is specified,
335         the ? command will display a brief informative message about the
336         specified command.  If no command is specified, a list of available
337         commands will be displayed.
339                 o ! [shell command] If "shell command"
340         is specified, the !  command will execute a shell locally and run
341         the specified shell command. If no command is specified, a local shell
342         will be run.
344          o exit Terminate the connection with the server and
345         exit from the program.
347          o help [command] See the ?
348         command above.
350          o quit See the exit command.
352 o Event Log
354                 o eventlog
355                 list the events
357 o Service Control
359         It is possible to use command-line completion (if you have
360         the GNU readline library) for Service names, by pressing the
361         tab key.
363                 o svcenum
364                 [-i] Lists Services Manager
366                 o svcinfo
367                 <service> Service Information
369                 o svcstart
370                 <service> [arg 0] [arg 1] ... Start Service
372                 o svcstop
373                 <service> Stop Service
375 o Scheduler
377                 o at
378                 Scheduler control (at /? for syntax)
380 o Registry
382         It is possible to use command-line completion (if you have
383         the GNU readline library) for registry key and value names,
384         by pressing the tab key.
386                 o regenum
387                 <keyname> Registry Enumeration (keys, values)
389                 o regdeletekey
390                 <keyname> Registry Key Delete
392                 o regcreatekey
393                 <keyname> [keyclass] Registry Key Create
395                 o shutdown
396                 [-m message] [-t timeout] [-r or --reboot] Server Shutdown
398                 o regqueryval
399                 <valname> Registry Value Query
401                 o regquerykey
402                 <keyname> Registry Key Query
404                 o regdeleteval
405                 <valname> Registry Value Delete
407                 o regcreateval
408                 <valname> <valtype> <value> Registry Key Create
410                 o reggetsec
411                 <keyname> Registry Key Security
413                 o regtestsec
414                 <keyname> Test Registry Key Security
416 o Printing
418         It is possible to use command-line completion (if you have
419         the GNU readline library) for Printer and job names, by
420         pressing the tab key.
422                 o spoolenum
423                 Enumerate Printers
425                 o spooljobs
426                 <printer name> Enumerate Printer Jobs
428                 o spoolopen
429                 <printer name> Spool Printer Open Test
431 o Server
433                 o time
434                 Display remote time
436                 o brsinfo
437                 Browser Query Info
439                 o wksinfo
440                 Workstation Query Info
442                 o srvinfo
443                 Server Query Info
445                 o srvsessions
446                 List sessions on a server
448                 o srvshares
449                 List shares on a server
451                 o srvtransports
452                 List transports on a server
454                 o srvconnections
455                 List connections on a server
457                 o srvfiles
458                 List files on a server
460 o Local Security Authority
462                 o lsaquery
463                 Query Info Policy (domain member or server)
465                 o lsaenumdomains
466                 Enumerate Trusted Domains
468                 o lookupsids
469                 Resolve names from SIDs
471                 o lookupnames
472                 Resolve SIDs from names
474                 o querysecret
475                 LSA Query Secret (developer use)
477 o NETLOGON
479                 o ntlogin
480                 [username] [password] NT Domain login test
482                 o domtrust
483                 <domain> NT Inter-Domain test
485                 o samsync
486                 SAM Synchronization Test (experimental)
488 o SAM Database
490         It is possible to use command-line completion (if you have
491         the GNU readline library) for user, group, alias and domain
492         names, by pressing the tab key.
494                 o lookupdomain
495                 Obtain SID for a local domain
497                 o enumusers
498                 SAM User Database Query (experimental!)
500                 o addgroupmem
501                 <group rid> [user] [user] ... SAM Add Domain Group Member
503                 o addaliasmem
504                 <alias rid> [member sid1] [member sid2] ... SAM Add Domain Alias Member
506                 o delgroupmem
507                 <group rid> [user] [user] ... SAM Delete Domain Group Member
509                 o delaliasmem
510                 <alias rid> [member sid1] [member sid2] ... SAM Delete Domain Alias Member
512                 o creategroup
513                 SAM Create Domain Group
515                 o createalias
516                 SAM Create Domain Alias
518                 o createuser
519                 <username> SAM Create Domain User
521                 o delgroup
522                 SAM Delete Domain Group
524                 o delalias
525                 SAM Delete Domain Alias
527                 o ntpass
528                 NT SAM Password Change
530                 o samuserset2
531                 <username> [-s acb_bits] SAM User Set Info 2 (experimental!)
533                 o samuserset
534                 <username> [-p password] SAM User Set Info (experimental!)
536                 o samuser
537                 <username> SAM User Query (experimental!)
539                 o samgroup
540                 <groupname> SAM Group Query (experimental!)
542                 o samalias
543                 <aliasname> SAM Alias Query
545                 o samaliasmem
546                 <aliasname> SAM Alias Members
548                 o samgroupmem
549                 SAM Group Members
551                 o samtest
552                 SAM User Encrypted RPC test (experimental!)
554                 o enumaliases
555                 SAM Aliases Database Query (experimental!)
557                 o enumdomains
558                 SAM Domains Database Query (experimental!)
560                 o enumgroups
561                 SAM Group Database Query (experimental!)
563                 o dominfo
564                 SAM Query Domain Info
566                 o dispinfo
567                 SAM Query Display Info
569 NOTES
571 Some servers are fussy about the case of supplied usernames,
572 passwords, share names (AKA service names) and machine names. If you
573 fail to connect try giving all parameters in uppercase.
575 It is often necessary to use the -n option when connecting
576 to some types of servers. For example OS/2 LanManager insists on a valid
577 NetBIOS name being used, so you need to supply a valid name that would
578 be known to the server.
580 rpcclient only works on servers that support MSRPC over SMB.  This includes
581 all versions of Windows NT, including the ports to Unix such as AS/U and
582 AFPS.  Support for MSRPC over SMB in other servers is currently rare and
583 patchy, for example Samba 2.0 only supports a limited set of MSRPC commands,
584 and some of those are not supported very well.
586 ENVIRONMENT VARIABLES
588 The variable USER may contain the username of the person using the
589 client.  This information is used only if the protocol level is high
590 enough to support session-level passwords.
592 The variable PASSWORD may contain the password of the person using
593 the client.  This information is used only if the protocol level is
594 high enough to support session-level passwords.
596 INSTALLATION
598 The location of the client program is a matter for individual system
599 administrators. The following are thus suggestions only.
601 It is recommended that the rpcclient software be installed in the
602 /usr/local/samba/bin or /usr/samba/bin directory, this directory
603 readable by all, writeable only by root. The client program itself
604 should be executable by all. The client should NOT be setuid or
605 setgid!
607 The client log files should be put in a directory readable and
608 writeable only by the user.
610 To test the client, you will need to know the name of a running
611 SMB/CIFS server. It is possible to run smbd (8)
612 an ordinary user - running that server as a daemon on a
613 user-accessible port (typically any port number over 1024) would
614 provide a suitable test server.
616 DIAGNOSTICS
618 Most diagnostics issued by the client are logged in a specified log
619 file. The log file name is specified at compile time, but may be
620 overridden on the command line.
622 The number and nature of diagnostics available depends on the debug
623 level used by the client. If you have problems, set the debug level to
624 3 and peruse the log files.
626 VERSION
628 This man page is correct for version 2.0 of the Samba suite.
630 BUGS
632 o WARNING!
633 The MSPRC over SMB code has been developed from examining Network traces.
634 No documentation is available from the original creators (Microsoft) on
635 how MSRPC over SMB works, or how the individual MSRPC services work.
636 Microsoft's implementation of these services has been demonstrated (and
637 reported) to be... a bit flakey in places.
639 The development of Samba's implementation of these services is also
640 a bit rough, and as more of the services are understood, it can even result
641 in versions of smbd (8) and rpcclient that are
642 incompatible for some commands or services.  Additionally, the developers
643 are sending reports to Microsoft, and problems found by or reported to
644 Microsoft are fixed in Service Packs, which may also result in
645 incompatibilities.
647 It is therefore not guaranteed that the execution of an rpcclient command will
648 work.  It is also not guaranteed that the target server will continue to
649 operate, i.e the execution of an MSRPC command may cause a remote service to
650 fail, or even cause the remote server to fail.  Usual rules apply, of course:
651 the developers bear absolutely no responsibility for the use, misuse, or
652 lack of use of rpcclient, by any person or persons, whether legal,
653 illegal, accidental, deliberate, intentional, malicious, curious, etc.
655 o Command Completion
656 Command-completion (available if you have the GNU readline library) used on
657 certain commands may not operate correctly if the word being completed (such as a registry key) contains a space.  Typically, the name will be completed, but
658 you will have to go back and put quotes round it, yourself.
660 o SAM Database command-completion
661 Command-completion (available if you have the GNU readline library) of user,
662 group and alias names does not work on remote Domains, which would normally
663 be specified like this: 
665 DOMAIN_name\\user_name. 
667 The only names that can be completed in this fashion are the local names
668 in the SAM database of the target server.
670 AUTHOR
672 The original Samba software and related utilities were created by
673 Andrew Tridgell samba-bugs@samba.org. Samba is now developed
674 by the Samba Team as an Open Source project similar to the way the
675 Linux kernel is developed.
677 The original Samba man pages were written by Karl Auer. The man page
678 sources were converted to YODL format (another excellent piece of Open
679 Source software, available at
680 ftp://ftp.icce.rug.nl/pub/unix/)
681 and updated for the Samba2.0 release by Jeremy Allison.  This man page
682 was developed cut-and-paste style from the smbclient man page, by
683 Luke Kenneth Casson Leighton.
684 samba-bugs@samba.org.
686 See samba (7) to find out how to get a full
687 list of contributors and details on how to submit bug reports,
688 comments etc.