Fix SSH authentication errors
Hi there! If you are encountering SSH public key authentication errors when using Deploybot, don't worry - there are some things you can check to resolve the issue. Here are some helpful steps to follow:
First, when attempting to add a server to your project, you may receive a message stating that Deploybot couldn't access the server using the credentials provided, and asking if you've uploaded the appropriate public key onto the server. If you see this message, there are a few things you should check:
- Make sure you've added the key from the following location within your project: https://your-deploy-domain.deploybot.com/
- Check that the key has been added to ~/.ssh/authorized_keys on your server, for your deployment user.
- Make sure the permissions of the ~/.ssh directory and the authorized_keys file are set to
- drwx------ 8 testuser staff 256 21 Sep 14:00 /Users/testuser/.ssh ,
- rw------- 1 testuser staff 1211 21 Nov 16:29 /Users/testuser/.ssh/authorized_keys,
- respectively. If they're not, you can modify them using the following commands:
- $ chmod 700 ~/.ssh/
- $ chmod 600 ~/.ssh/authorized_keys
Please note that if you're able to connect locally via your own public key pair, it's possible that your server accepts a different key format than what Deploybot generates, which is ED25519 on newer projects, or RSA on older projects. Currently, DeployBot only uses RSA keys.
For additional information about SSH login failures, you can check your authorization log file, which is typically located within /var/log/auth.log on most Linux systems. To monitor this log while you test a connection from Deploybot, you can run the following command: tail -f /var/log/auth.log. You may need to update your LogLevel to a high enough verbosity as well, to ensure that useful information is provided when testing. This is normally configured within /etc/ssh/sshd_config and the line will look like so: LogLevel DEBUG. If you make any changes to the configuration, you'll likely need to restart the sshd process for it to take effect.
I hope this information helps you resolve your issue!