DirectAdmin SSH Key Issue
Problem
DirectAdmin’s SSH Public Keys web interface (sometmes!) doesn’t work properly – it rejects all RSA and ED25519 keys with “Invalid RSA key” error, even though the keys are valid and work on other systems.
Workaround: Use DirectAdmin’s web terminal to manually add the key to ~/.ssh/authorized_keys
Solution Steps
Step 1: Generate SSH Key (Local Machine)
ssh-keygen -t rsa -b 4096 -f ~/.ssh/your_account_key -N "" -C "user@directadmin-de.kxe.io"
This creates:
~/.ssh/your_account_key– Private key (keep safe)~/.ssh/your_account_key.pub– Public key (needed for server)
Step 2: Get Your Public Key (Local Machine)
cat ~/.ssh/your_account_key.pub
Copy the entire output – it looks like:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDSh... user@directadmin-de.kxe.io
Step 3: Access DirectAdmin Terminal
- Log into DirectAdmin: https://directadmin-de.kxe.io:2222/evo/login
- Go to Account Manager → Terminal (or Shell Access)
- You’ll get a web-based terminal prompt
Step 4: Create SSH Directory and Add Key (Server Terminal)
Run these commands in the DirectAdmin terminal:
mkdir -p ~/.ssh
chmod 700 ~/.ssh
Then paste this command (replace the key with your actual key):
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDShAbgUugz2df0XgIzRvj3JEtUKSKpzFz5J7WegYsUFsY/s46vs2N8r0ZpSy4u7pX5oWiIKG2ttjXP6khM25Od4cX1WOpMeV2EPdeVqojiVS6ghcQ9DUN4XbC03w98FSLOGAQMOs3SCh8DGMxTQcqb8L8CSPGwYLoR6z4YhZm6GRx8d7HRCPaxbV6XR3ZXR2MWmLRJ9JaE36jYL1IXWDHmvfhzUwkgyT0WQw63jOjhhv4NysCUKDeVGpJNvhjmpENqzkkvwAMxECAu4NcU4Tez5L0bZu0TwVt87GWAAFmG9MEyxGZiVtH93SzNXbTZWrNpTGEB2iOB9JlkDJ0q3wbkIKKTSTbtGapI7pZ6gfN/H6iQyDZNZAxa7SHP0z19lbqVWD/FEdt95XMXmVUDHtR5hfeMgsrMy9PNGWHMSZ8Vhl6EGmR+u9iH/QddM0i95/xj8HnxpFOG/aCaSTAMWSC6v+mwWx//bskj6OQ/1dYiUMCCDWS+3ZJyaQVRbIE9ESeCy5+RYNiPkgVy75I5SpMyO4opr1xHx9yDbqv6NHd76hvcSQgK3mXMBNFQygVSIdwOoLRUQKI+A+LATeEXZ5QAo3dyFsG0ENvz9OlUCPEHUaUzKpfuvtJbIm7jpogE1hG9/QJ2lw+XrEp/5pD8mcC28sGKSTR8sdka2IH+qVp4OQ==' > ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Step 5: Verify It Worked (Server Terminal)
cat ~/.ssh/authorized_keys
You should see your public key displayed.
Step 6: Test SSH Connection (Local Machine)
ssh -i ~/.ssh/your_account_key user@directadmin-de.kxe.io -p 10500
If successful, you’ll get a shell prompt. Type exit to disconnect.
Step 7: Add to SSH Config (Local Machine)
Edit ~/.ssh/config and add:
Host your-account-directadmin
HostName directadmin-de.kxe.io
User your_username
Port 10500
IdentityFile ~/.ssh/your_account_key
IdentitiesOnly yes
Now you can just do:
ssh your-account-directadmin
Why This Works
- DirectAdmin’s web interface has a bug/limitation in the SSH key field validation
- The web terminal bypasses the buggy UI and directly creates the authorized_keys file
- Once the key is in authorized_keys, SSH authentication works perfectly
- The key format is standard OpenSSH format that all SSH servers accept
When to Use This
- First time setup of an account with SSH access
- If DirectAdmin UI rejects your key with “Invalid RSA key” error
- For multiple accounts – faster than fighting with the web interface
- When adding multiple keys to one account
Important Notes
- The private key (
your_account_key) stays on your local machine – NEVER share it - The public key (
your_account_key.pub) goes on the server – this is safe to share - DirectAdmin terminal access is required to set up the initial key
- After first key is added, you can add more keys via authorized_keys without needing the terminal
Troubleshooting
Still getting “Permission denied”:
- Verify the entire public key was copied (should be one long line)
- Check file permissions:
ls -la ~/.ssh/should showrw-------for authorized_keys - Verify SSH is enabled in the DirectAdmin hosting plan
Can’t access DirectAdmin terminal:
- SSH must be enabled in your hosting plan
- You may need to contact support to enable terminal access first
Multiple keys on same account:
Just append additional keys to authorized_keys:
echo 'ssh-rsa AAAA...second_key_here' >> ~/.ssh/authorized_keys
Example: faucetlist.org Setup
For reference, this is what was done for faucetlist.org:
- Generated key:
ssh-keygen -t rsa -b 4096 -f ~/.ssh/faucetlist_key_rsa - Accessed DirectAdmin terminal for faucetlist account
- Ran:
mkdir -p ~/.ssh && chmod 700 ~/.ssh - Pasted key:
echo 'ssh-rsa AAAA...' > ~/.ssh/authorized_keys - Set permissions:
chmod 600 ~/.ssh/authorized_keys - Tested:
ssh -i ~/.ssh/faucetlist_key_rsa faucetlist@directadmin-de.kxe.io -p 10500 - Added to ~/.ssh/config as
faucetlist-directadmin - Deploy script now works:
./deploy-to-directadmin.sh