RPCCLIENT(8)

NAME
rpcclient - developer's tool

SYNOPSIS

rpcclient
    [-d debuglevel] [-S server] [-l logbasename] [-n netbios name] [-N] [-m maxprotocol] [-I destIP] [-E] [-U username] [-W workgroup] [-c `command string`] [-t terminalcode] [-i scope] [-O socket options] [-s smb.conf]

DESCRIPTION

rpcclient
    is a utility for developers that combines the commands found in regedit, samedit and others. To find out more about the commands found in rpcclient refer to the samedit, regedit and other manual pages. These commands together perform the tasks seen by the Windows NT Server Tools.

OPTIONS

-d debuglevel
    set the debuglevel. Debug level 0 is the lowest and 100 being the highest. This should be set to 100 if you are planning on submitting a bug report to the Samba team (see BUGS.txt).

-S server
    NetBIOS name of Server to connect to (\\. or . for localhost). The server can be any SMB/CIFS server. The name is resolved using either the "name resolve order = " line or by using the -R option.

-l logbasename
    File name for log/debug files. .client will be appended. The log file is never removed by the client.

-n netbios name
    NetBIOS name of the local machine. This option is only needed if your Samba client cannot find it automatically. Samba should use the uppercase of the machine's hostname.

-N  tells rpcclient not to ask for a password. rpcclient will prompt the user by default.

-m max protocol
    is ignored in Samba TNG. It is included only for backwards compatibility.

-I destIP
    The IP address of the server specified with the -S option. Only needed when the server's NetBIOS name cannot be resolved using WINS or broadcast and isn't found in the LMHOSTS file.

-E  causes regedit to write messages to stderr instead of stdout.

-U username[%pass]
    Sets the SMB username or username and password. If %pass is not specified, The user will be prompted. The client will first check the USER environment variable, then the LOGNAME variable and if either exist, the string is uppercased. Anything in these variables following a % sign will be treated as the password. If these environmental variables are not found, the username GUEST is used.

-W domain
    Set the SMB domain. Note that this is very different from the DNS domain name. For information on NT domains, consult Lars Kneschke's Samba TNG FAQ at if(http://www.kneschke.de/projekte/samba_tng/). This overrides the default domain which is the domain of the server specified with the bt(-S) option. If the domain specified is the same as the server's NetBIOS name, it causes the client to log on using the server's local SAM (as opposed to the Domain SAM).

-c 'command string'
    execute semicolon separated commands (listed below))

-t terminalcode
    This tells the Samba client how to interpret the incoming filenames, in regards to character sets. The list here is not complete. For a complete list see your local Samba source. Some valid options are sjis, euc, jis7, jis8, junet and hex.

-O socket options
    These socket options are the same as in smb.conf (under the bt(socket options = ) section).

-s smb.conf
    Specifies the location of the all important smb.conf file.

-i scope
    Defines the NetBIOS scope. For more information on NetBIOS scopes, see rfc1001 and rfc1002. NetBIOS scopes are rarely used.

COMMANDS

SAMEDIT Commands

ntlogin

domtrust

samsync

lookupdomain

lookuprids

samlookupnames

enumusers

addgroupmem

addaliasmem

delgroupmem

delaliasmem

creategroup

createalias

createuser

deluser

delgroup

delalias

ntpass

samquerysync

samuserset2

samuserset

samuser

samgroup

samalias

samaliasmem

samgroupmem

samtest

enumaliases

enumdomains

enumgroups

enumprivs

lsaenumsids

dominfo

dispinfo

REGEDIT Commands

regenum

regdeletekey

regcreatekey

shutdown

regqueryval

regquerykey

regdeleteval

regcreateval

reggetsec

regtestsec

Other RPC Commands

srvtransports

Controlling rpcclient

set

use

help

quit

SAMEDIT

ntlogin [username]
    Logs into an NT domain as username.

domtrust
    Experimental NT netlogon test

samsync
    Experimental command that Synchronises the SAM database on a Backup Domain Controller with a Primary Domain Controller.

lookupdomain
    Returns the SID string for the local NT domain.

samlookuprids [-d domain] <RID> [<RID>...]
    Return a value associated with a specified RID in the specified NT domain

samlookupnames [-d domain] <name> [<name>...]
    Return a RID associated with the specified name(s) in the specified NT domain

enumusers
    Experimental SAM database query command Shows all users in the current domain

addgroupmem <grouprid> [user...]
    Adds a user to the group specified by grouprid.

addaliasmem <grouprid> [member sid...]
    Adds a Domain Alias member

delgroupmem <grouprid> [user...]
    Removes members from the group specified by grouprid.

delaliasmem <grouprid> [member sid...]
    Removes a Domain Alias member

creategroup <group>
    Creates a domainwide (Global) group in the domain.

createalias <alias>
    Creates a domain alias.

createuser <acct_name> [-i] [-s] [-L] [-j] <dom_name> [-p password]
    Creates an account in the NT domain. To create a machine trust account, append a '$' sign.

-i    Inter-Domain trust
-s    Server Trust (BDC)
-L    Local Account
-j    Password to assign to the account

deluser <accountname>
    Removes an account from the domain.

delgroup <group name>
    Removes a group from the domain.

delalias <alias name>
    Removes an alias from the domain.

ntpass
    Change the NT password.

samquerysec <user name>
    Query SAM security object

samuserset2 <acct_name> [-s acb_bits] [-c acb_bits]

where acct_name is the account name (append a '$' sign for a machine account) and domain_name. The values for acb_bits can be determined by adding wanted values from the following:

	N  User password not required
	D  User account disabled
	H  Home directory required
	T  Temporary duplicate account
	U  Normal user account
	M  MNS logon user account
	W  Workstation trust account
	S  Server trust account
	L  Account locked
	X  User password does not expire
	I  Interdomain trust account
	P  Password is locked and cannot be changed remotely

-c    clear ACB bits
-s    set ACB bits

Example: samedit -S . -U root -c 'samuserset2 test_user -c D'

Hints:

1.  samuserset2 without any option prints out all implemented acb_bits.

2.  Example to read out the acb_bits from ldap: ldapsearch -D 'cn=root,dc=samba-tng,dc=org' 'ntuid=Administrator' acctFlags -W

samuserset <acct_name> [<-p password> [-F Full Name] [-H Home Dir] [-D Home Drive] [-P profile path] [-L Login script]]

where acct_name is the account name (append a '$' sign for a machine account) and password is the password to change to

-p    change password to 'password'
-F    Change Full name to 'Full Name'
-H    Change Home Directory to 'Home Dir'
-D    Change Home directory drive to 'Home Drive'
-P    Set profile path to 'Profile Path'
-L    Set Login script to 'Login Script'

samuser <name> [-a | -u | -g]
    Do a query on a username in the SAM database. The option that follows the name can be used to show user aliases -a, user account details -u or user groups -g.

samgroup <name>
    Do a SAM query on a group account.

samalias <name>
    Do a SAM query on an alias account

samaliasmem <name>
    Query SAM alias members.

samgroupmem
    Do a SAM query on group members

samtest
    encrypted RPC-based SAM test

enumaliases
    experimental SAM alias query Shows all aliases in the SAM

enumdomains
    expermental domain query

enumgroups
    experimental SAM group query Shows all groups in the current domain

enumprivs [-i]
    Lists the short (internal) names of all the privileges/rights known by the current server. With the -i, it will also show the long textual representation (currently in German ;-)).

lsaenumsids
    Show the SIDs that have privileges assigned to them

dominfo
    experimental domain info query

dispinfo
    SAM query display info

REGEDIT

regenum <keyname>
    Registry key enumeration

regdeletekey <keyname>
    Deletes the specified registry key.

regcreatekey <keyname> [keyclass]
    Creates the specified registry key

shutdown [-m message] [-t timeout] [-r] [-f]
    Forces a remote shutdown or reboot (if the -r option is set) of an NT machine.

regqueryval <valname>
    Registry Value Query

regquerykey <keyname>
    Registry Key Query

regdeleteval <valname>
    Delete registry key specified by valname

regcreateval <val_name> <val_type> <val>
    Create a registry value.

reggetsec
    Get registry key security

regtestsec <keyname>
    Test registry key security

Other RPC Commands

srvtransports
    Lists the NetBIOS transports configured on the server. This shows, among other things, the server's 48-bit MAC (Ethernet) addresses: look in the "address name" field of each transport. Normally one uses ARP to get this information but that only works within a broadcast domain.

    In the case of multiple network interfaces, you can correlate a NetBIOS transport with a specific IP number if the server is NT 5 (Win2k/XP): The "transport name" field in the srvtransports output will end with a GUID - for example, {3A1AC65C-F1D4-4ADD-B288-082DF3118F95}. Use regenum to retrieve the list of values in HKLM\System\CurrentControlSet\Services\{3A1AC65C-F1D4-4ADD-B288-082DF3118F95}\Parameters\Tcpip, which will include IPAddress and DhcpIPAddress. (Unlike the srvtransports call, regenum cannot be made anonymously.)

Controlling rpcclient

set [OPTIONS...]
    Runs rpcclient within itself (thus allowing command line options to be changed).

use [\\Server] [-U user%pass] [-W domain] [-d] [-f]
    or

use -u
    Equivalent of the net use command in Windows NT. Can be used to connect to remote services.

help, ?
    Shows all commands or help on a specific command.

quit, exit, bye
    Exits the utility.

BUGS
Samba TNG is still in alpha stage and considered not suitable for production use.

From Luke Leighton's original rpcclient man page: "WARNING! The MSRPC over SMB code has been developed from examining Network traces. No documentation is available from the original creators (Microsoft) on how MSRPC over SMB works, or how the individual MSRPC services work. Microsoft's implementation of these services has been demonstrated (and reported) to be... a bit flakey in places.

The development of Samba's implementation is also a bit rough, and as more of the services are understood, it can even result in versions of smbd(8) and rpcclient that are incompatible for some commands or services. Additionally, the developers are sending reports to Microsoft, and problems found or reported to Microsoft are fixed in Service Packs, which may result in incompatibilities."

SEE ALSO
samba (7), samedit (8), regedit (8)

AUTHOR
Samba is written by The Samba Team as Open Source. This man page was written by Matthew Geddes and has strongly "borrowed" from Luke Kenneth Casson Leighton's original rpcclient man page and wise words and the Samba source.