Man pages sections > man8 > net

net - Tool for administration of Samba and remote CIFS servers.

NET(8) System Administration tools NET(8)

NAME

net - Tool for administration of Samba and remote CIFS servers.

SYNOPSIS

net {<ads|rap|rpc>} [-h|--help] [-w|--workgroup workgroup] [-W|--myworkgroup myworkgroup] [-U|--user user] [-I|--ipaddress ip-address] [-p|--port port] [-n myname] [-s conffile] [-S|--server server] [-l|--long] [-v|--verbose] [-f|--force] [-P|--machine-pass] [-d debuglevel] [-V] [--request-timeout seconds] [-t|--timeout seconds] [-i|--stdin] [--tallocreport]

DESCRIPTION

This tool is part of the samba(7) suite.
The Samba net utility is meant to work just like the net utility available for windows and DOS. The first argument should be used to specify the protocol to use when executing a certain command. ADS is used for ActiveDirectory, RAP is using for old (Win9x/NT3) clients and RPC can be used for NT4 and Windows 2000. If this argument is omitted, net will try to determine it automatically. Not all commands are available on all protocols.

OPTIONS

-?|--help
Print a summary of command line options.
-k|--kerberos
Try to authenticate with kerberos. Only useful in an Active Directory environment.
-w|--workgroup target-workgroup
Sets target workgroup or domain. You have to specify either this option or the IP address or the name of a server.
-W|--myworkgroup workgroup
Sets client workgroup or domain
-U|--user user
User name to use
-I|--ipaddress ip-address
IP address of target server to use. You have to specify either this option or a target workgroup or a target server.
-p|--port port
Port on the target server to connect to (usually 139 or 445). Defaults to trying 445 first, then 139.
-n|--netbiosname <primary NetBIOS name>
This option allows you to override the NetBIOS name that Samba uses for itself. This is identical to setting the netbios name parameter in the smb.conf file. However, a command line setting will take precedence over settings in smb.conf.
-S|--server server
Name of target server. You should specify either this option or a target workgroup or a target IP address.
-l|--long
When listing data, give more information on each item.
-v|--verbose
When listing data, give more verbose information on each item.
-f|--force
Enforcing a net command.
-P|--machine-pass
Make queries to the external server using the machine account of the local server.
--request-timeout 30
Let client requests timeout after 30 seconds the default is 10 seconds.
-t|--timeout 30
Set timeout for client operations to 30 seconds.
--use-ccache
Try to use the credentials cached by winbind.
-i|--stdin
Take input for net commands from standard input.
--tallocreport
Generate a talloc report while processing a net command.
-T|--test
Only test command sequence, dry-run.
-F|--flags FLAGS
Pass down integer flags to a net subcommand.
-C|--comment COMMENT
Pass down a comment string to a net subcommand.
-n|--myname MYNAME
Use MYNAME as a requester name for a net subcommand.
-c|--container CONTAINER
Use a specific AD container for net ads operations.
-M|--maxusers MAXUSERS
Fill in the maxusers field in net rpc share operations.
-r|--reboot
Reboot a remote machine after a command has been successfully executed (e.g. in remote join operations).
--force-full-repl
When calling "net rpc vampire keytab" this option enforces a full re-creation of the generated keytab file.
--single-obj-repl
When calling "net rpc vampire keytab" this option allows one to replicate just a single object to the generated keytab file.
--clean-old-entries
When calling "net rpc vampire keytab" this option allows one to cleanup old entries from the generated keytab file.
--db
Define dbfile for "net idmap" commands.
--lock
Activates locking of the dbfile for "net idmap check" command.
-a|--auto
Activates noninteractive mode in "net idmap check".
--repair
Activates repair mode in "net idmap check".
--acls
Includes ACLs to be copied in "net rpc share migrate".
--attrs
Includes file attributes to be copied in "net rpc share migrate".
--timestamps
Includes timestamps to be copied in "net rpc share migrate".
-X|--exclude DIRECTORY
Allows one to exclude directories when copying with "net rpc share migrate".
--destination SERVERNAME
Defines the target servername of migration process (defaults to localhost).
-L|--local
Sets the type of group mapping to local (used in "net groupmap set").
-D|--domain
Sets the type of group mapping to domain (used in "net groupmap set").
-N|--ntname NTNAME
Sets the ntname of a group mapping (used in "net groupmap set").
-R|--rid RID
Sets the rid of a group mapping (used in "net groupmap set").
--reg-version REG_VERSION
Assume database version {n|1,2,3} (used in "net registry check").
-o|--output FILENAME
Output database file (used in "net registry check").
--wipe
Create a new database from scratch (used in "net registry check").
--precheck PRECHECK_DB_FILENAME
Defines filename for database prechecking (used in "net registry import").
--no-dns-updates
Do not perform DNS updates as part of "net ads join".
-e|--encrypt
This command line parameter requires the remote server support the UNIX extensions or that the SMB3 protocol has been selected. Requests that the connection be encrypted. Negotiates SMB encryption using either SMB3 or POSIX extensions via GSSAPI. Uses the given credentials for the encryption negotiation (either kerberos or NTLMv1/v2 if given domain/username/password triple. Fails the connection if encryption cannot be negotiated.
-d|--debuglevel=level
level is an integer from 0 to 10. The default value if this parameter is not specified is 1.
 
The higher this value, the more detail will be logged to the log files about the activities of the server. At level 0, only critical errors and serious warnings will be logged. Level 1 is a reasonable level for day-to-day running - it generates a small amount of information about operations carried out.
 
Levels above 1 will generate considerable amounts of log data, and should only be used when investigating a problem. Levels above 3 are designed for use only by developers and generate HUGE amounts of log data, most of which is extremely cryptic.
 
Note that specifying this parameter here will override the log level parameter in the smb.conf file.
-V|--version
Prints the program version number.
-s|--configfile=<configuration file>
The file specified contains the configuration details required by the server. The information in this file includes server-specific information such as what printcap file to use, as well as descriptions of all the services that the server is to provide. See smb.conf for more information. The default configuration file name is determined at compile time.
-l|--log-basename=logdirectory
Base directory name for log/debug files. The extension ".progname" will be appended (e.g. log.smbclient, log.smbd, etc...). The log file is never removed by the client.
--option=<name>=<value>
Set the smb.conf(5) option "<name>" to value "<value>" from the command line. This overrides compiled-in defaults and options read from the configuration file.

COMMANDS

CHANGESECRETPW

This command allows the Samba machine account password to be set from an external application to a machine account password that has already been stored in Active Directory. DO NOT USE this command unless you know exactly what you are doing. The use of this command requires that the force flag (-f) be used also. There will be NO command prompt. Whatever information is piped into stdin, either by typing at the command line or otherwise, will be stored as the literal machine password. Do NOT use this without care and attention as it will overwrite a legitimate machine password without warning. YOU HAVE BEEN WARNED.

TIME

The NET TIME command allows you to view the time on a remote server or synchronise the time on the local server with the time on the remote server.

TIME

Without any options, the NET TIME command displays the time on the remote server. The remote server must be specified with the -S option.

TIME SYSTEM

Displays the time on the remote server in a format ready for /bin/date. The remote server must be specified with the -S option.

TIME SET

Tries to set the date and time of the local server to that on the remote server using /bin/date. The remote server must be specified with the -S option.

TIME ZONE

Displays the timezone in hours from GMT on the remote server. The remote server must be specified with the -S option.

[RPC|ADS] JOIN [TYPE] [--no-dns-updates] [-U username[%password]] [createupn=UPN] [createcomputer=OU] [machinepass=PASS] [osName=string osVer=string] [options]

Join a domain. If the account already exists on the server, and [TYPE] is MEMBER, the machine will attempt to join automatically. (Assuming that the machine has been created in server manager) Otherwise, a password will be prompted for, and a new account may be created.
[TYPE] may be PDC, BDC or MEMBER to specify the type of server joining the domain.
[UPN] (ADS only) set the principalname attribute during the join. The default format is host/netbiosname@REALM.
[OU] (ADS only) Precreate the computer account in a specific OU. The OU string reads from top to bottom without RDNs, and is delimited by a '/'. Please note that '\' is used for escape by both the shell and ldap, so it may need to be doubled or quadrupled to pass through, and it is not used as a delimiter.
[PASS] (ADS only) Set a specific password on the computer account being created by the join.
[osName=string osVer=String] (ADS only) Set the operatingSystem and operatingSystemVersion attribute during the join. Both parameters must be specified for either to take effect.

[RPC] OLDJOIN [options]

Join a domain. Use the OLDJOIN option to join the domain using the old style of domain joining - you need to create a trust account in server manager first.

[RPC|ADS] USER

[RPC|ADS] USER

List all users

[RPC|ADS] USER DELETE target

Delete specified user

[RPC|ADS] USER INFO target

List the domain groups of the specified user.

[RPC|ADS] USER RENAME oldname newname

Rename specified user.

[RPC|ADS] USER ADD name [password] [-F user flags] [-C comment]

Add specified user.

[RPC|ADS] GROUP

[RPC|ADS] GROUP [misc options] [targets]

List user groups.

[RPC|ADS] GROUP DELETE name [misc. options]

Delete specified group.

[RPC|ADS] GROUP ADD name [-C comment]

Create specified group.

[RAP|RPC] SHARE

[RAP|RPC] SHARE [misc. options] [targets]

Enumerates all exported resources (network shares) on target server.

[RAP|RPC] SHARE ADD name=serverpath [-C comment] [-M maxusers] [targets]

Adds a share from a server (makes the export active). Maxusers specifies the number of users that can be connected to the share simultaneously.

SHARE DELETE sharename

Delete specified share.

[RPC|RAP] FILE

[RPC|RAP] FILE

List all open files on remote server.

[RPC|RAP] FILE CLOSE fileid

Close file with specified fileid on remote server.

[RPC|RAP] FILE INFO fileid

Print information on specified fileid. Currently listed are: file-id, username, locks, path, permissions.

[RAP|RPC] FILE USER user

List files opened by specified user. Please note that net rap file user does not work against Samba servers.

SESSION

RAP SESSION

Without any other options, SESSION enumerates all active SMB/CIFS sessions on the target server.

RAP SESSION DELETE|CLOSE CLIENT_NAME

Close the specified sessions.

RAP SESSION INFO CLIENT_NAME

Give a list with all the open files in specified session.

RAP SERVER DOMAIN

List all servers in specified domain or workgroup. Defaults to local domain.

RAP DOMAIN

Lists all domains and workgroups visible on the current network.

RAP PRINTQ

RAP PRINTQ INFO QUEUE_NAME

Lists the specified print queue and print jobs on the server. If the QUEUE_NAME is omitted, all queues are listed.

RAP PRINTQ DELETE JOBID

Delete job with specified id.

RAP VALIDATE user [password]

Validate whether the specified user can log in to the remote server. If the password is not specified on the commandline, it will be prompted.
 
 
Note
 
 
Currently NOT implemented.
 

RAP GROUPMEMBER

RAP GROUPMEMBER LIST GROUP

List all members of the specified group.

RAP GROUPMEMBER DELETE GROUP USER

Delete member from group.

RAP GROUPMEMBER ADD GROUP USER

Add member to group.

RAP ADMIN command

Execute the specified command on the remote server. Only works with OS/2 servers.
 
 
Note
 
 
Currently NOT implemented.
 

RAP SERVICE

RAP SERVICE START NAME [arguments...]

Start the specified service on the remote server. Not implemented yet.
 
 
Note
 
 
Currently NOT implemented.
 

RAP SERVICE STOP

Stop the specified service on the remote server.
 
 
Note
 
 
Currently NOT implemented.
 

RAP PASSWORD USER OLDPASS NEWPASS

Change password of USER from OLDPASS to NEWPASS.

LOOKUP

LOOKUP HOST HOSTNAME [TYPE]

Lookup the IP address of the given host with the specified type (netbios suffix). The type defaults to 0x20 (workstation).

LOOKUP LDAP [DOMAIN]

Give IP address of LDAP server of specified DOMAIN. Defaults to local domain.

LOOKUP KDC [REALM]

Give IP address of KDC for the specified REALM. Defaults to local realm.

LOOKUP DC [DOMAIN]

Give IP's of Domain Controllers for specified DOMAIN. Defaults to local domain.

LOOKUP MASTER DOMAIN

Give IP of master browser for specified DOMAIN or workgroup. Defaults to local domain.

CACHE

Samba uses a general caching interface called 'gencache'. It can be controlled using 'NET CACHE'.
All the timeout parameters support the suffixes:
s - Seconds
m - Minutes
h - Hours
d - Days
w - Weeks

CACHE ADD key data time-out

Add specified key+data to the cache with the given timeout.

CACHE DEL key

Delete key from the cache.

CACHE SET key data time-out

Update data of existing cache entry.

CACHE SEARCH PATTERN

Search for the specified pattern in the cache data.

CACHE LIST

List all current items in the cache.

CACHE FLUSH

Remove all the current items from the cache.

GETLOCALSID [DOMAIN]

Prints the SID of the specified domain, or if the parameter is omitted, the SID of the local server.

SETLOCALSID S-1-5-21-x-y-z

Sets SID for the local server to the specified SID.

GETDOMAINSID

Prints the local machine SID and the SID of the current domain.

SETDOMAINSID

Sets the SID of the current domain.

GROUPMAP

Manage the mappings between Windows group SIDs and UNIX groups. Common options include:
 
•unixgroup - Name of the UNIX group
 
•ntgroup - Name of the Windows NT group (must be resolvable to a SID
 
•rid - Unsigned 32-bit integer
 
•sid - Full SID in the form of "S-1-..."
 
•type - Type of the group; either 'domain', 'local', or 'builtin'
 
•comment - Freeform text description of the group
 

GROUPMAP ADD

Add a new group mapping entry:
 
net groupmap add {rid=int|sid=string} unixgroup=string \
	[type={domain|local}] [ntgroup=string] [comment=string]
 
 

GROUPMAP DELETE

Delete a group mapping entry. If more than one group name matches, the first entry found is deleted.
net groupmap delete {ntgroup=string|sid=SID}

GROUPMAP MODIFY

Update an existing group entry.
net groupmap modify {ntgroup=string|sid=SID} [unixgroup=string] \
       [comment=string] [type={domain|local}]
 
 

GROUPMAP LIST

List existing group mapping entries.
net groupmap list [verbose] [ntgroup=string] [sid=SID]

MAXRID

Prints out the highest RID currently in use on the local server (by the active 'passdb backend').

RPC INFO

Print information about the domain of the remote server, such as domain name, domain sid and number of users and groups.

[RPC|ADS] TESTJOIN

Check whether participation in a domain is still valid.

[RPC|ADS] CHANGETRUSTPW

Force change of domain trust password.

RPC TRUSTDOM

RPC TRUSTDOM ADD DOMAIN

Add a interdomain trust account for DOMAIN. This is in fact a Samba account named DOMAIN$ with the account flag 'I' (interdomain trust account). This is required for incoming trusts to work. It makes Samba be a trusted domain of the foreign (trusting) domain. Users of the Samba domain will be made available in the foreign domain. If the command is used against localhost it has the same effect as smbpasswd -a -i DOMAIN. Please note that both commands expect a appropriate UNIX account.

RPC TRUSTDOM DEL DOMAIN

Remove interdomain trust account for DOMAIN. If it is used against localhost it has the same effect as smbpasswd -x DOMAIN$.

RPC TRUSTDOM ESTABLISH DOMAIN

Establish a trust relationship to a trusted domain. Interdomain account must already be created on the remote PDC. This is required for outgoing trusts to work. It makes Samba be a trusting domain of a foreign (trusted) domain. Users of the foreign domain will be made available in our domain. You'll need winbind and a working idmap config to make them appear in your system.

RPC TRUSTDOM REVOKE DOMAIN

Abandon relationship to trusted domain