Control panels

Plesk CLI commands: common admin tasks with plesk bin

Run plesk bin on a Linux VPS to create domains, subscriptions, mail accounts and databases without the web interface, plus repair and extension checks.

AdvancedLinux server7 min read

Plesk CLI commands let you create domains, subscriptions, mail accounts and databases on a Linux VPS without opening the Plesk web interface. Everything below runs through plesk bin over SSH as root, and each step shows what you should see before you move on.

This is an administrator's reference, not a first install. You need a working Plesk installation before any of it applies.

Before you start

  • A Linux VPS running Plesk Obsidian (see how to install Plesk on a Linux VPS if you have not set it up yet).
  • Root SSH access to the server. Almost every plesk bin utility refuses to run as a non-root user.
  • Your VPS provider's control panel open in a tab, so you can use the browser console or power controls if an SSH session drops.
  • A note of the IP you want new subscriptions bound to. Get it from ipmanage below, not from memory.

Warning: Commands that create subscriptions, mailboxes or databases write to live data. Take a backup first and test on one domain before you run a script across all of them.

Find the right command and check its syntax

The CLI is a set of small utilities under one wrapper. Start by listing them and then reading the help for the one you need.

Bash
which plesk
sudo plesk bin --help
sudo plesk bin domain --help

plesk bin --help prints every utility name — domain, subscription, mail, database, extension, php_handler and others. Each of those takes its own --help flag.

Plesk changes option names between versions, so treat your own --help output as the source of truth and check the vendor's documentation when a flag does not behave as described here.

Inspect what is already on the server

Read before you write. These are safe, read-only commands.

Bash
sudo plesk bin site --list
sudo plesk bin domain --list
sudo plesk bin domain --info example.com
sudo plesk bin subscription --list
sudo plesk bin service_plan --list
sudo plesk bin ipmanage --list

domain --info is the one you will use most: it returns the hosting type, document root, IP address, PHP handler and status for a single domain. ipmanage --list shows which addresses are available for new subscriptions — copy the exact address from there.

Create and manage subscriptions

A subscription in Plesk bundles a domain, a system user and a service plan. Create it in one command.

Bash
sudo plesk bin subscription --create example.com \
  -owner admin \
  -service-plan "Default Domain" \
  -ip 203.0.113.10 \
  -login deploy \
  -passwd 'ChangeMe-2049'
  • -owner is the Plesk account that owns the subscription, usually admin.
  • -service-plan must match a plan name exactly, including case. Confirm it with service_plan --list.
  • -login sets the system user that owns the files under /var/www/vhosts/example.com.
  • -ip is the address from ipmanage --list.

If you only need the domain record without a full subscription, plesk bin domain --create creates it inside an existing subscription. Run plesk bin domain --create --help first, because the required flags differ from subscription --create.

To confirm:

Bash
sudo plesk bin domain --info example.com

Warning: plesk bin subscription --remove example.com deletes the domain, its databases and its mail. Files under the subscription's directory may go with it. Back up first.

For a walkthrough of the same task in the web interface, including service plans, see create a domain, subscription and service plan in Plesk.

Manage mail accounts

Mailboxes are created per domain. The mail service for that domain has to be enabled first.

Bash
sudo plesk bin mail --create info@example.com -passwd 'ChangeMe-2049' -mailbox true
sudo plesk bin mail --list example.com
sudo plesk bin mail --update info@example.com -passwd 'NewPass-2049'

-mailbox true creates a real mailbox that stores mail. Without it, you get a forwarder entry with no storage. Password changes through mail --update take effect immediately — no service restart needed.

To remove a mailbox:

Bash
sudo plesk bin mail --remove info@example.com

Warning: Removing a mailbox deletes its stored messages. Pull anything you need with an IMAP client or an SFTP copy of the maildir first.

Create and drop databases

Bash
sudo plesk bin database --list -domain example.com
sudo plesk bin database --create mydb \
  -domain example.com \
  -type mysql \
  -login dbuser \
  -passwd 'ChangeMe-2049'

-type is mysql or postgresql, depending on what the server has installed. Plesk creates the database and the user together and grants the user rights on that database only.

Bash
sudo plesk bin database --remove mydb -domain example.com

Warning: database --remove drops the database and its contents with no confirmation prompt. Dump it first with mysqldump — see automating MySQL backups with mysqldump and cron.

Extensions, PHP handlers and repair

Bash
sudo plesk bin extension --list
sudo plesk bin php_handler --list
sudo plesk repair all -y
sudo plesk repair web -y
sudo plesk repair mail -y

extension --list shows the extension id for everything installed. Some extensions expose their own CLI through Plesk; the exact subcommands come from that extension's own documentation, so do not guess them.

php_handler --list returns the handler ids you can pass to a domain update when you change the PHP version. For the per-domain workflow, see change the PHP version and settings per domain in Plesk.

plesk repair fixes configuration drift — permissions, vhost files, mail settings. Run all when something is broken across the board, and the narrower targets when you know where the problem is.

Check it works

Run these after any change:

Bash
sudo plesk bin domain --info example.com | head -20
sudo plesk bin mail --info info@example.com
curl -I http://example.com

domain --info should show the correct IP, document root and PHP handler. mail --info should list the mailbox you created. The curl response should return an HTTP status line rather than a connection error — a 000 code means the vhost is not serving yet.

You can also open the site in a browser and confirm Plesk serves the default page from /var/www/vhosts/example.com/httpdocs.

Troubleshooting

  • plesk: command not found — Plesk is not installed, or your shell path does not include it. Try the full path /usr/sbin/plesk, and confirm you are root with whoami.
  • Unable to find service plan — the plan name is case-sensitive or belongs to a different owner. List them with sudo plesk bin service_plan --list and copy the name exactly.
  • Domain name is not valid or the domain already exists — a leftover subscription, DNS zone or hosting entry still holds the name. Check sudo plesk bin domain --list and remove the stale record first.
  • Permission denied writing to httpdocs — the files are owned by a different system user than the one you passed with -login. Inspect with ls -l /var/www/vhosts/example.com and fix ownership, or recreate the subscription user.
  • Mail creation fails with the mail service disabled — enable the mail service for that domain in the Plesk interface, or check sudo plesk bin mail --help for the flag that toggles it in your version.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.