net
The net
command is a versatile utility in Samba that provides a range of network and administrative operations. It allows you to manage various aspects of Samba, including domain operations, user and group management, and more. Below are the main uses and commands of net
.
General Usage
Common Subcommands and Their Usage
Domain Management
Joining a Domain
This command joins a Samba server to an Active Directory domain.
Leaving a Domain
This command removes a Samba server from an Active Directory domain.
Checking Domain Trust
This command lists the trusted domains for the Samba server.
User and Group Management
Adding a User
This command adds a new user to the Samba server.
Deleting a User
This command deletes a user from the Samba server.
Listing Users
This command lists all users on the Samba server.
Adding a Group
This command adds a new group to the Samba server.
Deleting a Group
This command deletes a group from the Samba server.
Listing Groups
This command lists all groups on the Samba server.
Adding a User to a Group
This command adds a user to a specified group.
Removing a User from a Group
This command removes a user from a specified group.
Share Management
Creating a Share
This command creates a new share on the Samba server.
Deleting a Share
This command deletes a share from the Samba server.
Listing Shares
This command lists all shares on the Samba server.
Print Management
Listing Printers
This command lists all printers on the Samba server.
Adding a Printer
This command adds a new printer to the Samba server.
Deleting a Printer
This command deletes a printer from the Samba server.
Password Management
Setting a User's Password
This command sets the password for a specified user.
Changing Own Password
This command allows a user to change their own password.
Examples
Join a Samba Server to a Domain
Example output:
List All Users
Example output:
Create a New Share
Example output:
List All Shares
Example output:
Set User Password
Example interaction:
Summary
net ads join
Joins a Samba server to an AD domain
net ads join -U administrator
net ads join -U administrator
net rpc user add
Adds a new user
net rpc user add username -U administrator
net rpc user add john.doe -U administrator
net rpc group add
Adds a new group
net rpc group add groupname -U administrator
net rpc group add developers -U administrator
net usershare add
Creates a new share
net usershare add sharename path "Comment" everyone:F
net usershare add public /srv/samba/public "Public Share" everyone:F guest_ok=y
net rpc password
Sets a user's password
net rpc password username -U administrator
net rpc password john.doe -U administrator
Conclusion
The net
command in Samba provides extensive functionality for managing domains, users, groups, shares, printers, and passwords. It is a crucial tool for Samba administrators to perform a wide variety of administrative tasks efficiently. Understanding the different subcommands and their options allows administrators to effectively manage and maintain a Samba server in a network environment.
Last updated