> For the complete documentation index, see [llms.txt](https://wiki.datadike.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.datadike.com/pam/administration/access/permission-best-practices.md).

# Permission best practices

How to design roles and authorizations for least privilege: groups instead of people, folders by environment, the smallest account and action, expiry, and regular review.

## What this is and when to use it

A PAM holds the keys to everything else. An authorization that gives every user every asset, with every account and every action, turns it back into a shared password list with a nicer screen. Every compromised login then reaches every server. When an auditor asks "who can reach this database, and why?", the only honest answer is "everyone, because nobody narrowed it".

This page describes how to lay out [roles](https://wiki.datadike.com/pam/administration/identities/roles.md) and [authorizations](https://wiki.datadike.com/pam/administration/access/authorizations.md) so that the answer to that question can be read straight off the rule list. Use it when you set up a new deployment, when you take over one that grew without a plan, and as the reference for periodic access reviews.

The model is role-based access control (RBAC). Access follows the job a person does, expressed as a group. It does not follow the person's name.

## The principles

| Principle                                  | What it means in practice                                                                                                                                                            |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Least privilege**                        | Each person reaches only the assets, accounts, protocols and actions the job needs, and nothing "just in case"                                                                       |
| **Deny by default**                        | Without an authorization there is no access. Start from nothing and add, never start from everything and remove                                                                      |
| **Groups, not people**                     | Rules name groups that mirror job functions. People enter and leave the groups, and the rules stay put                                                                               |
| **Separation of duties**                   | Whoever grants access does not approve it, whoever approves does not request it, and whoever audits is not audited by themselves                                                     |
| **No standing privilege for the critical** | The most powerful accounts are reached on demand, with approval or [just-in-time](https://wiki.datadike.com/pam/administration/access/just-in-time.md), not through a permanent rule |
| **Every rule explains itself**             | The name says who gets what, and the comment says why, who asked, and when it is reviewed                                                                                            |
| **Reviewed on a schedule**                 | Access that nobody looks at only grows. Rules are recertified at a fixed interval                                                                                                    |

## Two layers: roles and authorizations

The product separates two questions, and both need answering.

| Layer             | Question it answers                                                                                           | Where it is set                                                                           |
| ----------------- | ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| **Role**          | What may this person do *in the console*: which screens, which administrative actions                         | [Roles and permissions](https://wiki.datadike.com/pam/administration/identities/roles.md) |
| **Authorization** | Which assets and accounts may this person *reach*, over which protocols, with which actions, and for how long | [Authorizations](https://wiki.datadike.com/pam/administration/access/authorizations.md)   |

They are independent. An auditor may hold a strong role and no authorization. An operator may hold the plain *Org User* role and authorizations to a hundred servers. Most mistakes come from solving one layer with the other, such as handing out an administrator role so that someone can reach a server.

## Designing authorizations

Each authorization answers *who*, *what*, *which accounts*, *how* and *until when*. Decide each one deliberately.

### Who: groups that mirror job functions

* Create one group per job function, not per person: Linux operators, Windows administrators, database administrators, network team, application support, and one group per third-party company.
* When users come from Active Directory or LDAP, import the groups too, and keep the import on a schedule (see [LDAP and Active Directory](https://wiki.datadike.com/pam/administration/identities/ldap-and-ad.md)). Someone who changes team in the directory then changes access here, and someone who leaves loses it.
* Name directory groups so that their purpose is obvious, for example `PAM-Linux-Operators` or `PAM-Vendor-Acme`.
* A rule aimed at a single user is an exception. It always carries an expiry date and a comment that says why it exists.

### What: folders that mirror environment and criticality

Organise the asset tree so that one folder means one level of risk:

```
Production/
  Linux/
  Windows/
  Databases/
  Network/
  Web consoles/
Staging/
Development/
```

* Point rules at **folders**, not at individual assets. A new server placed in the right folder inherits the right access, with no rule to edit.
* Keep production and non-production in separate folders and separate rules. A rule that covers both grants production to everyone who only needed staging.
* Do not point a general rule at the root of the tree. The root holds everything, including what is added tomorrow.

### Which accounts: the smallest that does the job

| Option                    | When to use it                                                                                                                                |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **Specified accounts**    | The default. Name the operational account the job uses, for example a service operator account rather than `root`                             |
| **Same account**          | When people have their own accounts on the targets, with the same name as in the PAM. It keeps individual accountability on the target itself |
| **Manual account**        | When the person must type a credential that the PAM does not store. There is no rotation and no vault control over it                         |
| **Anonymous account**     | Web and custom assets that need no login by the PAM                                                                                           |
| **All existing accounts** | Only for the small team that administers the assets themselves. It includes `root`, `Administrator`, and any account added to the asset later |

Accounts with full control (`root`, `Administrator`, domain administrators, database `sys`/`sa`) get a rule of their own: a small group, with [approval](https://wiki.datadike.com/pam/administration/access/approvals.md) or just-in-time, with session recording and [command filtering](https://wiki.datadike.com/pam/administration/access/command-filtering.md).

Revealing a password in the console is a role permission, not an authorization. Keep it to the people who look after the vault, and prefer that everyone else connects through the PAM without ever seeing the secret.

### How: only the protocols in use

Grant the protocols the job uses: SSH and SFTP for a Linux team, RDP for a Windows team, the database protocol for DBAs. "All protocols" also opens whatever protocol the asset gains later.

### Actions: start from Connect

**Connect** is the only action every rule needs. Each of the others opens a path for data or for control, so add it only when the job needs it.

| Action                  | What it opens                                               | Grant it to                                                                  |
| ----------------------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------- |
| **Connect**             | The session itself                                          | Everyone covered by the rule                                                 |
| **Clipboard › Paste**   | Content from the user's computer goes into the session      | Administrators who paste commands and configuration, which is most of them   |
| **Clipboard › Copy**    | Content leaves the session for the user's computer          | Teams that need to bring output out. Third parties usually do not            |
| **Transfer › Upload**   | Files go into the asset                                     | Teams that deploy or deliver files                                           |
| **Transfer › Download** | Files leave the asset                                       | Only where taking files out is part of the job, and preferably with approval |
| **Transfer › Delete**   | Files on the asset are deleted through the transfer channel | Rarely                                                                       |
| **Share**               | Another user joins the live session                         | Support and training                                                         |

Do not tick **All** to save time. Copy and Download are the two channels by which data leaves a protected environment, and they are the first things an auditor asks about.

### Until when: every exception expires

* Rules aimed at groups can be permanent, because the group membership is what changes.
* Rules aimed at an individual, at a third party, or at a project always carry a **Date expired**. When the rule expires, sessions still open under it are terminated.
* For a one-off need, use [just-in-time access](https://wiki.datadike.com/pam/administration/access/just-in-time.md) instead of creating and later forgetting a rule.
* Third parties combine expiry, a time window and approval of each connection. See [Restrict a third party to specific assets](https://wiki.datadike.com/pam/administration/access/third-party-access.md).

### Overlapping rules: the broadest one wins

When two rules cover the same asset for the same user, **the least restrictive one wins**. A broad rule therefore cancels every narrow rule underneath it. A deployment with one "everything for everyone" rule and twenty careful rules behaves exactly like the broad rule alone.

## Designing roles

* **System administrator.** Two or three named people, each with personal login and MFA. Not used for day-to-day connections to assets. Never a shared login.
* **Org Admin.** The administrators of one organization. If two business units must not administer each other, they are two organizations, not two folders.
* **Org Auditor.** The security or compliance team. It sees sessions, recordings and logs, and needs no authorization to assets.
* **Org User.** Everyone who only connects to assets. This is most people.
* **Custom roles.** For duties that fall between those, for example a vault operator who manages accounts and rotation, or an access manager who creates authorizations but not users. Write in the role's comment what it is for.

Separate the duties around access:

| Activity                            | Who does it                                                                                                                                  | Who must not                    |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
| Create users and groups             | The directory, through the scheduled import, or the identity team                                                                            | The person being created        |
| Create and change authorizations    | The access manager                                                                                                                           | The person receiving the access |
| Approve access to critical accounts | The owner of the asset or the team lead                                                                                                      | The requester                   |
| Review sessions and rule changes    | The auditor                                                                                                                                  | The people being reviewed       |
| Use the emergency access            | Two people together, under the [break-glass procedure](https://github.com/DATADIKE-WIKI/docs/tree/wiki/en/pam/deploy-operate/break-glass.md) | Anyone alone                    |

Rule changes are recorded in the **Action log** of the [audit trail](https://wiki.datadike.com/pam/administration/audit/audit-trail.md). Reviewing it is how an administrator granting themselves access gets noticed.

## Naming and documenting rules

The name is the first thing an auditor reads. It says who gets what.

| Name                                                 | Verdict                                        |
| ---------------------------------------------------- | ---------------------------------------------- |
| `Linux operators - Production - operator account`    | Good: group, scope and account at a glance     |
| `Vendor Acme - ERP servers - until 2026-12-31`       | Good: the exception carries its end date       |
| `DBAs - Production databases - via approval`         | Good: the control is visible                   |
| `Full access`, `Test`, `Temp`, a person's first name | Bad: nobody can tell whether it can be removed |

In the **comment**, record who asked, the ticket or request number, the reason, and the next review date.

## Reference model

A starting point to adapt. Groups, folders and accounts are examples.

| Profile                         | Role                 | Group                  | Folders                    | Accounts                                 | Protocols                 | Actions                      | Validity                          |
| ------------------------------- | -------------------- | ---------------------- | -------------------------- | ---------------------------------------- | ------------------------- | ---------------------------- | --------------------------------- |
| Linux operator                  | Org User             | `PAM-Linux-Operators`  | Production/Linux           | Specified: operator account              | SSH, SFTP                 | Connect, Copy, Paste, Upload | Permanent                         |
| Linux administrator, privileged | Org User             | `PAM-Linux-Admins`     | Production/Linux           | Specified: `root`                        | SSH                       | Connect, Paste               | Approval or just-in-time          |
| Windows administrator           | Org User             | `PAM-Windows-Admins`   | Production/Windows         | Same account                             | RDP                       | Connect, Copy, Paste         | Permanent                         |
| Database administrator          | Org User             | `PAM-DBA`              | Production/Databases       | Specified: DBA account                   | Database protocols in use | Connect, Copy, Paste         | Permanent, `sys`/`sa` by approval |
| Network team                    | Org User             | `PAM-Network`          | Production/Network         | Specified: device administration account | SSH, HTTPS                | Connect, Copy, Paste         | Permanent                         |
| Third-party vendor              | Org User             | `PAM-Vendor-<company>` | The assets in the contract | Specified                                | Only those needed         | Connect, Paste               | Expiry, time window and approval  |
| Auditor                         | Org Auditor          | `PAM-Audit`            | None                       | None                                     | None                      | None                         | Permanent                         |
| PAM administrator               | System administrator | Named people           | None by default            | None                                     | None                      | None                         | Asset access through just-in-time |

## Anti-patterns

| Anti-pattern                                                          | Why it hurts                                                                         | Do this instead                                |
| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------- |
| One rule for all users, the root folder, all accounts and all actions | Every compromised login reaches everything, and the rule cancels every narrower rule | Rules per group and folder                     |
| Rules aimed at individual users                                       | Rules multiply, and people who change team or leave keep their access                | Groups, imported from the directory            |
| **All existing accounts** by habit                                    | It includes `root`, `Administrator` and accounts added later                         | **Specified accounts**                         |
| **All** in the actions by habit                                       | It opens Copy and Download, the channels by which data leaves                        | Start from **Connect**                         |
| Rules for people or third parties with no expiry                      | Temporary access becomes permanent                                                   | **Date expired**, or just-in-time              |
| Test rules left behind                                                | Nobody knows whether they can be removed                                             | Expiry from the start, a clear name, a comment |
| Many system administrators, or a shared administrator login           | No accountability and a large target                                                 | Two or three named people, with MFA            |
| The requester approves their own access                               | Approval with no control                                                             | An approver who is not the requester           |
| Production and staging in the same rule                               | Staging access becomes production access                                             | Separate folders and rules                     |

## Cleaning up an existing deployment

When the rules already grant too much, narrow them without blocking anyone.

1. **Export the current rules** to a file, as a snapshot to compare against. See [Bulk authorizations](https://wiki.datadike.com/pam/administration/access/bulk-authorizations.md).
2. **Find the broad rules**: all users or very large groups, the root folder, **All existing accounts**, **All** in the actions, no expiry.
3. **Look at what is really used.** **Audit › Console › Session records** shows who connected to which asset, with which account and protocol, over the last 30 to 90 days. Build the groups from that, not from memory.
4. **Create the narrow rules** by group and folder. The bulk import speeds this up.
5. **Test with one person from each group** (see the next section). Remember that the broad rule still overrides everything while it is active.
6. **Turn the broad rule off** by clearing **Active**. Do not delete it yet.
7. **Wait one or two weeks.** If somebody lost access they needed, add it to the right group rule, not back to the broad one.
8. **Delete the broad rule**, and record the date of the next review.

## How to verify it worked

Check from the user's side, not from the rule list:

1. Log in as a member of each group, or ask one to.
2. The asset list shows the assets of that group's folders, and none from other folders or environments.
3. Opening an asset outside the group's scope is refused.
4. The actions behave as granted. With Copy not granted, text copied inside the session does not reach the computer's clipboard. With Download not granted, the download is refused.
5. A user in no group sees no assets at all.
6. In **Audit › Log audit › Action log**, the cleanup shows as changes to the authorizations, with who made them and when.

Test what must *not* work as well as what must. Testing only what should work leaves excess access undetected, and excess access is the failure that matters here.

## Review checklist

Run it quarterly for internal groups, and monthly for third parties.

* No rule covers all users, or the root of the asset tree.
* Every rule names a group, and rules for individuals carry an expiry date.
* No active rule is past its expiry date or left over from a test.
* **All existing accounts** and **All** actions appear only where they are justified in the comment.
* Critical accounts are reached only with approval or just-in-time.
* People who left the company are disabled, and the directory import ran.
* The number of system administrators is still two or three.
* Privileged accounts were [rotated](https://wiki.datadike.com/pam/administration/accounts/rotation.md) on schedule, and after anyone who knew the password left.
* Rules with no session in 90 days are reviewed for removal.

## Related pages

* [Authorizations](https://wiki.datadike.com/pam/administration/access/authorizations.md): every field of a rule
* [Roles and permissions](https://wiki.datadike.com/pam/administration/identities/roles.md): what a person may do in the console
* [Just-in-time access](https://wiki.datadike.com/pam/administration/access/just-in-time.md): access on demand instead of a permanent rule
* [Approval workflows](https://wiki.datadike.com/pam/administration/access/approvals.md): holding critical access until someone releases it
* [Restrict a third party to specific assets](https://wiki.datadike.com/pam/administration/access/third-party-access.md)
