|
|
net — Tool for administration of Samba and remote CIFS servers.
net
{<ads|rap|rpc>} [-h] [-w workgroup] [-W myworkgroup] [-U user] [-I ip-address] [-p port] [-n myname] [-s conffile] [-S server] [-l] [-P] [-d debuglevel] [-V]
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.
Print a summary of command line options.
Sets target workgroup or domain. You have to specify either this option or the IP address or the name of a server.
Sets client workgroup or domain
User name to use
IP address of target server to use. You have to specify either this option or a target workgroup or a target server.
Port on the target server to connect to (usually 139 or 445). Defaults to trying 445 first, then 139.
This option allows you to override
the NetBIOS name that Samba uses for itself. This is identical
to setting the parameter in the smb.conf
file.
However, a command
line setting will take precedence over settings in
smb.conf
.
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.
Name of target server. You should specify either this option or a target workgroup or a target IP address.
When listing data, give more information on each item.
Make queries to the external server using the machine account of the local server.
level
is an integer
from 0 to 10. The default value if this parameter is
not specified is zero.
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 parameter
in the smb.conf
file.
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.
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.
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.
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.
Enumerates all exported resources (network shares) on target server.
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.
Currently NOT implemented.
command
Execute the specified command
on
the remote server. Only works with OS/2 servers.
Currently NOT implemented.
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 |
Print the SID of the specified domain, or if the parameter is omitted, the SID of the domain the local server is in.
Manage the mappings between Windows group SIDs and UNIX groups. Parameters take the for "parameter=value". 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
Add a new group mapping entry:
net groupmap add {rid=int|sid=string} unixgroup=string \ [type={domain|local}] [ntgroup=string] [comment=string]
Delete a group mapping entry. If more then one group name matches, the first entry found is deleted.
net groupmap delete {ntgroup=string|sid=SID}
Prints out the highest RID currently in use on the local server (by the active 'passdb backend').
Print information about the domain of the remote server, such as domain name, domain sid and number of users and groups.
DOMAIM
Remove interdomain trust account for
DOMAIN
from the remote server.
Currently NOT implemented.
Shut down the remote server.
Reboot after shutdown.
Force shutting down all applications.
Timeout before system will be shut down. An interactive user of the system can use this time to cancel the shutdown.
Display the specified message on the screen to announce the shutdown.
Export users, aliases and groups from remote server to local server. Can only be run an a BDC.
Print out status of machine account of the local machine in ADS. Prints out quite some debug info. Aimed at developers, regular users should use NET ADS TESTJOIN.
EXPRESSION
ATTRIBUTES...
Perform a raw LDAP search on a ADS server and dump the results. The expression is a standard LDAP search expression, and the attributes are a list of LDAP fields to show in the results.
Example: net ads search '(objectCategory=group)' sAMAccountName
DN
(attributes)
Perform a raw LDAP search on a ADS server and dump the results. The DN standard LDAP DN, and the attributes are a list of LDAP fields to show in the result.
Example: net ads dn 'CN=administrator,CN=Users,DC=my,DC=domain' SAMAccountName
Starting with version 3.0.23, a Samba server now supports the ability for non-root users to add user define shares to be exported using the "net usershare" commands.
To set this up, first set up your smb.conf by adding to the [global] section : usershare path = /usr/local/samba/lib/usershares Next create the directory /usr/local/samba/lib/usershares, change the owner to root and set the group owner to the UNIX group who should have the ability to create usershares, for example a group called "serverops". Set the permissions on /usr/local/samba/lib/usershares to 01770. (Owner and group all access, no access for others, plus the sticky bit, which means that a file in that directory can be renamed or deleted only by the owner of the file). Finally, tell smbd how many usershares you will allow by adding to the [global] section of smb.conf a line such as : usershare max shares = 100. To allow 100 usershare definitions. Now, members of the UNIX group "serverops" can create user defined shares on demand using the commands below.
The usershare commands are:
net usershare add sharename path [comment] [acl] [guest_ok=[y|n]] - to add or change a user defined share. |
net usershare delete sharename - to delete a user defined share. |
net usershare info [-l|--long] [wildcard sharename] - to print info about a user defined share. |
net usershare list [-l|--long] [wildcard sharename] - to list user defined shares. |
sharename
path
[comment]
[acl]
[guest_ok=[y|n]]
Add or replace a new user defined share, with name "sharename".
"path" specifies the absolute pathname on the system to be exported. Restrictions may be put on this, see the global smb.conf parameters : "usershare owner only", "usershare prefix allow list", and "usershare prefix deny list".
The optional "comment" parameter is the comment that will appear on the share when browsed to by a client.
The optional "acl" field specifies which users have read and write access to the entire share. Note that guest connections are not allowed unless the smb.conf parameter "usershare allow guests" has been set. The definition of a user defined share acl is : "user:permission", where user is a valid username on the system and permission can be "F", "R", or "D". "F" stands for "full permissions", ie. read and write permissions. "D" stands for "deny" for a user, ie. prevent this user from accessing this share. "R" stands for "read only", ie. only allow read access to this share (no creation of new files or directories or writing to files).
The default if no "acl" is given is "Everyone:R", which means any authenticated user has read-only access.
The optional "guest_ok" has the same effect as the parameter of the same name in smb.conf, in that it allows guest access to this user defined share. This parameter is only allowed if the global parameter "usershare allow guests" has been set to true in the smb.conf.
There is no separate command to modify an existing user defined share, just use the "net usershare add [sharename]" command using the same sharename as the one you wish to modify and specify the new options you wish. The Samba smbd daemon notices user defined share modifications at connect time so will see the change immediately, there is no need to restart smbd on adding, deleting or changing a user defined share.sharename
Deletes the user defined share by name. The Samba smbd daemon immediately notices this change, although it will not disconnect any users currently connected to the deleted share.
[-l|--long]
[wildcard sharename]
Get info on user defined shares owned by the current user matching the given pattern, or all users.
net usershare info on its own dumps out info on the user defined shares that were created by the current user, or restricts them to share names that match the given wildcard pattern ('*' matches one or more characters, '?' matches only one character). If the '-l' or '--long' option is also given, it prints out info on user defined shares created by other users.
The information given about a share looks like : [foobar] path=/home/jeremy comment=testme usershare_acl=Everyone:F guest_ok=n And is a list of the current settings of the user defined share that can be modified by the "net usershare add" command.
[-l|--long]
wildcard sharename
List all the user defined shares owned by the current user matching the given pattern, or all users.
net usershare list on its own list out the names of the user defined shares that were created by the current user, or restricts the list to share names that match the given wildcard pattern ('*' matches one or more characters, '?' matches only one character). If the '-l' or '--long' option is also given, it includes the names of user defined shares created by other users.