Join our Newsletter — 33% off our NHI Course
Governance, Ownership & Risk

Createdb

← Back to Glossary
By NHI Mgmt Group Updated October 29, 2026 Domain: Governance, Ownership & Risk

Createdb is a PostgreSQL command-line utility for creating a new database. It connects to a server and creates the database from the server's default template or a specified template, with ownership and permissions set by the database server's access controls.

What Createdb Does

Createdb is a PostgreSQL client utility for provisioning a new database on a server. It is the administrative front end for database creation, not the storage engine itself, and it applies the server's ownership and permission rules when the new database is created.

Because it operates against a live PostgreSQL instance, createdb sits at the boundary between convenience and privilege. The command is simple to use, but the server ultimately decides whether the request succeeds, which template is used, and what access controls the resulting database inherits.

How Createdb Fits PostgreSQL Administration

In day-to-day administration, createdb is part of the routine lifecycle for PostgreSQL environments, especially when teams need a fresh database for an application, tenant, test harness, or migration workflow. The utility typically relies on a role's ability to connect to the server and create a database, so it is closely tied to server-side authorization rather than local file system permissions.

The new database is usually cloned from the default template, or from a specific template when one is requested. That makes createdb more than a naming command, because the template choice can influence schema content, extensions, and baseline objects that appear in the new database.

Ownership, Templates, and Access Controls

Database creation is not just a technical action, it is a governance decision about who owns the database and what baseline access it receives. In PostgreSQL, the server's access controls determine whether the caller can create the database at all, and the resulting object will then be governed by the database's ownership and permission model.

That matters because database creation can unintentionally inherit a permissive template, a broad owner role, or an access pattern that is wider than intended. For administrators, the important point is that createdb establishes a fresh security boundary, but it does not independently define policy, it executes the policy already enforced by PostgreSQL.

Operational Considerations When Using Createdb

Createdb is most useful when database provisioning is controlled, repeatable, and traceable. In practice, teams should treat it as an administrative utility that belongs in provisioning workflows, not as an ad hoc shortcut for bypassing change control or creating uncontrolled copies of production-like data.

When the command is used in automated deployment or tenant provisioning, the surrounding process should make the target server, the chosen template, and the owning role explicit. That keeps database creation predictable and reduces confusion when a database appears with inherited objects or permissions that differ from expectations.

Risk and Threat Considerations

Database creation is a privileged operation, so misuse can create unauthorized databases, broaden access, or propagate an insecure template into a new environment. The main security concern is not the command itself, but the fact that it can quickly materialise a new trusted container for data, roles, and application connectivity.

Failure mechanism: If a role with excessive privilege can run createdb, an attacker or careless operator may create shadow databases, reuse overly permissive templates, or establish an environment that later becomes harder to monitor and govern.

Impact: The result can be policy drift, data exposure through inherited permissions, operational sprawl, and a weaker audit trail for how new databases entered the estate.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack surface, NIST SP 800-53 Rev 5 and CIS Controls v8 set the technical controls, and ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5AC-6 — Least PrivilegeCreatedb depends on limiting who can create databases and by what authority.
IA-5 — Authenticator ManagementCreatedb is executed by authenticated administrative users or service accounts that must be controlled.
Recommendation — Restrict database-creation privilege to the minimum roles that need it. Manage privileged credentials used for PostgreSQL administration.
CIS Controls v8CIS-5 — Account ManagementDatabase creation rights are an account and role governance issue in PostgreSQL administration.
Recommendation — Inventory and control accounts or roles allowed to create databases.
ISO/IEC 27001:2022A.5.15 — Access controlCreatedb relies on enforced access rules for who may provision databases.
Recommendation — Define and enforce access rules for database creation and ownership.
OWASP API Security Top 10API5 Broken Function Level Authorization — Broken Function Level AuthorizationCreatedb is a privileged function whose misuse reflects missing authorization for administrative actions.
Recommendation — Authorize database-creation functions separately from routine user access.

Practitioner Guidance

Why practitioners should care: Treat createdb as a controlled provisioning action with ownership and approval attached. It should be available only to the roles that genuinely need database creation authority, especially in shared or production-adjacent PostgreSQL environments.

What to watch for: Review where template choice, owner assignment, and database-creation privilege are delegated, because those three decisions determine the security shape of the new database more than the command syntax does.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 29, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org