Skip to main content

"samba-tool" to Manage a Linux based Active Directory

A linux based Active Directory server can be managed from a Windows client using the Remote System Administration Tool very easily, and it is the convenient way for system administrators with only Microsoft Windows background. But for administrators who love to use the command line, "samba-tool" is a great command line tool to manage Active Directory configured on a Linux Box. Throughout this post and on my future posts I will be showing hands-on examples about using the "samba-tool" command.


User Management using samba-tool

Create a new user using samba-tool

Syntax: samba-tool user create <username> [<password>] [options]

samba-tool user create user1 password --given-name=firstname --surname=surname

The above command will create a new user with the name as user1 and password will be password, you can type your desired password. The options --given-name and --surname are to assign user first name and surname.


To make the user change password at first login add the option --must-change-at-next-login when creating the user


By default samba-tool creates the new user under the Users Organisational Unit, to create the user under a different OU use the option --userou='ou=OUNAME'



Set or reset password of a user

Syntax: samba-tool user setpassword (<username>|--filter <filter>) [options]

samba-tool user setpassword user1
or
samba-tool user setpassword --filter=samaccountname=user1

Both the above commands can be used to set or change password of a user


To force the user change password at next logon add option --must-change-at-next-login

samba-tool user setpassword user1 --must-change-at-next-login
or
samba-tool user setpassword --filter=samaccountname=user1 --must-change-at-next-login


To get detailed help and all the available options to create and manage users run this command
samba-tool user -h

Group Management using samba-tool

Create a new group

Syntax: samba-tool group add groupname [options]

samba-tool group add sales


The command above creates a new group named sales, because there is no options applied the group is created under the default organisational unit Users.

Change the group's OU and other parameters such group type and scope

samba-tool group add sales --groupou='ou=restrict' --group-type=Security --group-scope=Global


The above command creates a group sales under OU "restrict" with group type as security and group scope as global.

Add members to a group

Syntax: samba-tool group addmembers <groupname> <listofmembers> [options]

samba-tool group addmembers sales user1,user2,user3


Remove members from a group

Syntax: samba-tool group removemembers <groupname> <listofmembers> [options]

samba-tool group removemembers sales user2,user3


The above command removes the user2 and user3 from the group sales

List members of a group

Syntax: samba-tool group listmembers <groupname> [options]

samba-tool group listmembers sales


To get detailed help and all the available options to create and manage groups run this command:
samba-tool group -h


Comments

Popular posts from this blog

How to setup Active Directory in Linux using Samba4

Samba version 4 can work as a domain controller which is compatible with Microsoft Active Directory, companies can save licensing cost by switching to Samba4 for Active Directory. I will put below the complete steps. Software Requirements: 1. A latest linux based operating system, I will be using Centos 7 for this example, you can use any flavor of linux  2. We will be using Sernet Samba version 4.2, because the samba package provided in Centos 7 DVD uses MIT Kerberos which does not support Active Directory. Hardware Requirements: 1. A system with at least 1 GB RAM for better performance, at least 10 GB of disk space and a decent processor 2. You can use a desktop class or server class system depending on choice Download Links for required softwares: 1. Download Centos 7 DVD from the below link      CentOS 7 DVD 2. Download Sernet Samba & other required rpm packages      Sernet Samba 4.2 and other dependent packages for...

Citrix Xen Server Review

Citrix Xen Server The Fantastic Virtualisation Platform At No Cost Friends the IT infrastructure around the world have evolved to Virtualisation because of its flexibility and scalability. There are some big players in the virtualisation segment like VMWARE, Microsoft Hyper-V, and Citrix Xen Servers, etc. All these platforms have free and licensed software to create virtualised data center. All have their pros and cons. But I am writing this post only for Citrix Xen Server which I have been using since last 8 years, and it has given our data center tremendous flexibility, scalability, performance and durability at zero software licensing cost. I think it may be beneficial to other people to share my experience so that they can take a better decision to choose a virtualisation software for their IT infrastructure. Back in 2010 my company had purchased IBM blade servers and SAN based storage to upgrade its data center but without proper planning and after purchasing our company f...