Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Reading a directory

After this lesson: I can list the accounts and groups in my own directory and read one account's attributes.

55 min lesson4 commandsActive Directory security lab: a Samba domain controller to audit and harden on one private Ubuntu VM

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

One machine knows everyone

A college has hundreds of staff and students. One system holds every account and decides who may sign in where, and on a Windows network that system is Active Directory.

Your lab is a machine that runs one, built with Samba. Before you can keep it safe, you need to read it: the accounts, the groups and what each one is allowed to be.

The one rule

Warning

Read and change only your own lab directory. Running these checks against a real directory needs the owner's written permission. Without it, in the UK, it can break the Computer Misuse Act 1990. Your lab has no route to anyone else's machine.

Quick check: the rule

Have a go

Quick check: the rule

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

By the end of this lesson

Note

I can list the accounts and groups in my own directory and read one account's attributes.

Key words

WordWhat it meansExample
Directorythe store of a network's accounts, groups and machines
Domain controllerthe machine that runs the directory and checks sign-insDC01
Accounta user such as jadams, or a computer such as WEB01$
Attributeone fact stored on an accountsAMAccountName
Groupa set of accounts given rights togetherDomain Admins
Service accountan account a program signs in as, not a person

The cells students fill in are left blank in this preview.

Starter

Have a go

Starter

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

List the accounts

Your tool is samba-tool. Reading the directory needs administrator rights on the machine, so each command runs with sudo.

samba-tool user list prints every account. You should see six names. Two are built in: krbtgt, which Kerberos uses, and Guest.

List every account

Command
sudo samba-tool user list | sort

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Read one account's attributes

Command
sudo ldbsearch -H /var/lib/samba/private/sam.ldb '(sAMAccountName=jadams)' sAMAccountName givenName sn userPrincipalName

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

Check

Have a go

Check

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Groups and service accounts

A group gives rights to its members together. samba-tool group list prints them, and the one to watch is Domain Admins: a member of it controls the whole directory.

Then find the service accounts: accounts a program signs in as. The filter asks for any account with a service name set, leaving out krbtgt. There is one, svc-sql.

List the groups

Command
sudo samba-tool group list | sort

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

List the user service accounts

Command
sudo ldbsearch -H /var/lib/samba/private/sam.ldb '(&(servicePrincipalName=*)(objectCategory=person)(!(sAMAccountName=krbtgt)))' sAMAccountName servicePrincipalName

Shown here, not run. Press Start lab to type it into your own lab’s terminal.

A common mistake

Warning

Many people think the risk in a directory is a user with a weak password. That matters, but the bigger risks are an account in a powerful group that should not be there, and a service account nobody watches. The rest of this module is about finding and fixing those.

What you found

Six accounts, the Domain Admins group, and one service account, svc-sql, with a service name. Each of those is a thread the next lessons pull: how sign-in works, why that service account is dangerous, and who really holds the keys.

Open README.md in your home folder any time: it lists the accounts and the rule.

Exit quiz

Have a go

Exit quiz

5 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.