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:

  1. Make sure you've added the key from the following location within your project:
  2. Check that the key has been added to ~/.ssh/authorized_keys on your server, for your deployment user.
  3. Make sure the permissions of the ~/.ssh directory and the authorized_keys file are set to 
    1. drwx------ 8 testuser staff 256 21 Sep 14:00 /Users/testuser/.ssh ,
    2. rw------- 1 testuser staff 1211 21 Nov 16:29 /Users/testuser/.ssh/authorized_keys,
  4. respectively. If they're not, you can modify them using the following commands:
    1. $ chmod 700 ~/.ssh/
    2. $ 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. If this is the case, you can generate your own key locally and upload it as a custom key pair, then use that to connect instead. If you do upload a custom private key to your project, you'll need to upload it to any servers you're connecting to in the same way as outlined above, as well as the repository host.

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!

Still need help? Contact Us Contact Us