net - Tool for administration of Samba and remote CIFS servers.
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.
-h|--help
-w target-workgroup
-W workgroup
-U user
-I ip-address
-p port
-n <primary NetBIOS name>
parameter in the smb.conf file. However, a command line setting will take precedence over settings in smb.conf.
-s <configuration file>
-S server
-l
-P
-d|--debuglevel=level
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.
Without any options, the NET TIME command displays the time on the remote server.
Displays the time on the remote server in a format ready for /bin/date
Tries to set the date and time of the local server to that on the remote server using /bin/date.
Displays the timezone in hours from GMT on the remote computer.
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.
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.
List all users
Delete specified user
List the domain groups of a the specified user.
Rename specified user.
List user groups.
Delete specified group.
Enumerates all exported resources (network shares) on target server.
Adds a share from a server (makes the export active). Maxusers specifies the number of users that can be connected to the share simultaneously.
List all open files on remote server.
Close file with specified fileid on remote server.
Print information on specified fileid. Currently listed are: file-id, username, locks, path, permissions.
Note
Without any other options, SESSION enumerates all active SMB/CIFS sessions on the target server.
Close the specified sessions.
Give a list with all the open files in specified session.
List all servers in specified domain or workgroup. Defaults to local domain.
Lists all domains and workgroups visible on the current network.
Lists the specified print queue and print jobs on the server. If the QUEUE_NAME is omitted, all queues are listed.
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
List all members of the specified group.
Delete member from group.
Execute the specified command on the remote server. Only works with OS/2 servers.
Note
Start the specified service on the remote server. Not implemented yet.
Note
Currently NOT implemented.
Stop the specified service on the remote server.
Note
Change password of USER from OLDPASS to NEWPASS.
Lookup the IP address of the given host with the specified type (netbios suffix). The type defaults to 0x20 (workstation).
Give IP address of LDAP server of specified DOMAIN. Defaults to local domain.
Give IP address of KDC for the specified REALM. Defaults to local realm.
Give IP's of Domain Controllers for specified DOMAIN. Defaults to local domain.
Give IP of master browser for specified DOMAIN or workgroup. Defaults to local domain.
Samba uses a general caching interface called 'gencache'. It can be controlled using 'NET CACHE'.
All the timeout parameters support the suffixes:
Add specified key+data to the cache with the given timeout.
Delete key from the cache.
Update data of existing cache entry.
Search for the specified pattern in the cache data.
List all current items in the cache.
Remove all the current items from the cache.
Print the SID of the specified domain, or if the parameter is omitted, the SID of the domain the local server is in.
Sets domain sid for the local server to the specified SID.
Manage the mappings between Windows group SIDs and UNIX groups. Parameters take the for "parameter=value". Common options include:
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}
Update en existing group entry
net groupmap modify {ntgroup=string|sid=SID} [unixgroup=string] [comment=string] [type={domain|local}]
List existing group mapping entries
net groupmap list [verbose] [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.
Check whether participation in a domain is still valid.
Force change of domain trust password.
Add a interdomain trust account for DOMAIN to the remote server.
Remove interdomain trust account for DOMAIN from the remote server.
Note
Currently NOT implemented.
Establish a trust relationship to a trusting domain. Interdomain account must already be created on the remote PDC.
Abandon relationship to trusted domain
List all current interdomain trust relationships.
This subcommand is used to view and manage Samba's rights assignments (also referred to as privileges). There are three options current available: list, grant, and revoke. More details on Samba's privilege model and its use can be found in the Samba-HOWTO-Collection.
Abort the shutdown of a remote server.
Shut down the remote server.
-r
-f
-t timeout
-C message
Print out sam database of remote server. You need to run this against the PDC, from a Samba machine joined as a BDC.
Export users, aliases and groups from remote server to local server. You need to run this against the PDC, from a Samba machine joined as a BDC.
Fetch domain SID and store it in the local secrets.tdb.
Make the remote host leave the domain it is part of.
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.
Lookup info for PRINTER on SERVER. The printer name defaults to "*", the server name defaults to the local host.
Publish specified printer using ADS.
Remove specified printer from ADS directory.
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
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
Print out workgroup name for specified kerberos realm.
(Re)Create a BUILTIN group. Only a wellknown set of BUILTIN groups can be created with this command. This is the list of currently recognized group names: Administrators, Users, Guests, Power Users, Account Operators, Server Operators, Print Operators, Backup Operators, Replicator, RAS Servers, Pre-Windows 2000 ompatible Access. This command requires a running Winbindd with idmap allocation properly configured. The group gid will be allocated out of the winbindd range.
Create a LOCAL group (also known as Alias). This command requires a running Winbindd with idmap allocation properly configured. The group gid will be allocated out of the winbindd range.
Delete an existing LOCAL group (also known as Alias).
Map an existing Unix group and make it a Domain Group, the domain group will have the same name.
Remove an existing group mapping entry.
Add a member to a Local group. The group can be specified only by name, the member can be specified by name or SID.
Remove a member from a Local group. The group and the member must be specified by name.
List Local group members. The group must be specified by name.
List the specified set of accounts by name. If verbose is specified, the rid and description is also provided for each account.
Show the full DOMAIN\NAME the SID and the type for the corrisponding account.
Set the home directory for a user account.
Set the profile path for a user account.
Set the comment for a user or group account.
Set the full name for a user account.
Set the logon script for a user account.
Set the home drive for a user account.
Set the workstations a user account is allowed to log in from.
Set the "disabled" flag for a user account.
Set the "password not required" flag for a user account.
Set the "autolock" flag for a user account.
Set the "password do not expire" flag for a user account.
Set or unset the "password must change" flag fro a user account.
List the avilable account policies.
Show the account policy value.
Set a value for the account policy. Valid values can be: "forever", "never", "off", or a number.
Only available if ldapsam:editposix is set and winbindd is running. Properly populates the ldap tree with the basic accounts (Administrator) and groups (Domain Users, Domain Admins, Domain Guests) on the ldap tree.
Dumps the mappings in the specified output file.
Restore the mappings from the specified file or stdin.
Store a secret for the sepcified domain, used primarily for domains that use idmap_ldap as a backend. In this case the secret is used as the password for the user DN used to bind to the ldap server.
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:
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.
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.
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.
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.
Gives usage information for the specified command.
This man page is complete for version 3.0 of the Samba suite.
The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed.
The net manpage was written by Jelmer Vernooij.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |