DirectAdmin

Use SSH with a DirectAdmin account (access and SSH keys)

Get SSH enabled for your DirectAdmin user, add SSH keys in the panel, connect from Windows, macOS or Linux, and run common commands like WP-CLI, Composer and mysql.

IntermediateDirectAdmin2 min read

SSH gives you a secure command line on your hosting account. It is the fastest way to import large databases, run WP-CLI or Composer, extract big archives or search through files. DirectAdmin can manage SSH keys for you so you never type a password.

Before you start

  • SSH must be enabled for your account. In DirectAdmin it is a package feature; if the SSH Keys menu is missing, ask your reseller or host to enable it.
  • An SSH client: the built-in ssh command on Windows 10/11, macOS and Linux, or PuTTY.
  • The SSH port – often 22, but many servers use a custom port. Your welcome email or support can tell you.

Create a key pair

On your computer run:

ssh-keygen -t ed25519 -C "laptop"

Press Enter to accept the default file and set a passphrase for extra security. The public key is in ~/.ssh/id_ed25519.pub.

Add the key in DirectAdmin

  1. Log in and go to Advanced Features → SSH Keys.
  2. Click Paste Key (or Add Key).
  3. Paste the full content of the .pub file, give it a name and save.

You can also Create Key in DirectAdmin and download the private key, but generating it on your own computer is safer because the private key never leaves it.

Connect

ssh -p 22 username@server.example.com

Replace the port, your DirectAdmin user name and the server hostname. Confirm the fingerprint on the first connection. Your home directory contains domains/ with each site's public_html.

SFTP

The same credentials work for SFTP in FileZilla or WinSCP: choose protocol SFTP, enter host, port, user name and select your private key under the key settings. SFTP is the most secure way to transfer files. See also FTP accounts in DirectAdmin.

Useful commands

TaskCommand
Go to a sitecd ~/domains/example.com/public_html
WordPress maintenancewp plugin update --all (if WP-CLI is installed)
Import a databasemysql -u user_db -p user_db < dump.sql
Extract an archiveunzip site.zip or tar xzf site.tar.gz
Find large filesdu -sh ~/domains/* | sort -h
Use a specific PHP/usr/local/php83/bin/php -v

Security tips

  • Protect your private key with a passphrase and never share it.
  • Remove keys from SSH Keys when a device is lost or a developer leaves.
  • Use screen or tmux for long tasks so a dropped connection does not stop them.

Troubleshooting

  • Connection refused or timed out: wrong port, SSH disabled for your account, or your IP is blocked by the firewall or Brute Force Monitor.
  • Permission denied (publickey): the key was not added, or your client uses a different key. Specify it with -i ~/.ssh/id_ed25519.
  • Command not found: the tool is not installed for users, or you need its full path.

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.