Troubleshooting passwordless login

If ssh-copy-id or the Mac OS X command does not work on your Linux machine

  1. Create the keypair on your home computer.
  2. If ssh-copy-id doesn’t work for you, manually upload your public key to your DreamHost server. On your home computer run this command under your username where you created your key pair:
    [local]$ scp ~/.ssh/id_rsa.pub username@server.dreamhost.com:~/
    

    This copies the id_rsa.pub file on your home computer to your DreamHost SHELL user.

  3. Log into your DreamHost server through your SHELL user.
  4. Once logged into your DreamHost server, append the public key you just uploaded to your authorized_keys file. To do this, first make sure you’re in your user's directory. Make sure to change username to your Shell user.
    [server]$ pwd
    /home/username/
    
  5. In that directory, create the /.ssh folder:
    [server]$ mkdir .ssh
    
  6. Run the following command to create a new file named authorized_keys in the new /.ssh folder. This will also copy your id_rsa.pub file into this new authorized_keys file:
    [server]$ cat id_rsa.pub >> .ssh/authorized_keys
    
  7. Remove the original id_rsa.pub file in your SHELL user’s directory:
    [server]$ rm id_rsa.pub
    
  8. Make sure the permissions are correctly set on the /.ssh folder and /.ssh/authorized_keys. file. Run these three commands under your SHELL user:
    [server]$ chmod 700 ~/.ssh
    [server]$ chmod 600 ~/.ssh/authorized_keys
    

If everything is configured properly, you should now be able to access your DreamHost account through SSH without a password. Run this command on your home computer where you just created the original keypair.

[server]$ ssh username@server.dreamhost.com

For more information, see the man pages for ssh, ssh-keygen, ssh-copy-id, and sshd.

Unable to log in from Linux after the public key has been copied to your DreamHost server

You should be able to log in immediately after the key has been copied to your server. However it's possible you may see this error when logging in:

Error: Agent admitted failure to sign

To fix this, use ssh-agent to store your password in your current session.

  1. Start ssh-agent by running the following command. Make sure you use the backquote ` character and not a single quote – this backquote character is usually on the top left of your keyboard on the tilde ~ key:
    [local]$ eval `ssh-agent`
    
    • ssh-agent is a program that handles passwords for private keys.
  2. Run the following to add your private key to ssh-agent:
    [local]$ ssh-add
    

    If you gave your key a custom name when creating it, enter that custom name here. For example:

    [local]$ ssh-add ~/.ssh/customkey_rsa
    
  3. Enter your private key password (if you created one).
  4. Enter the following into your .bash_profile or .bashrc file to kill the ssh-agent when logging out.
    [local]$ kill $SSH_AGENT_PID
    

When you now log into your server via SSH, you are not prompted for a password.

Unable to log in from Mac OSX after the public key has been copied to your DreamHost server

If you are unable to log in automatically after uploading your public key, it may be because you are using custom keypair names; that is, you are using something other than id_rsa/id_rsa.pub. This is common when one maintains multiple keypairs.

Enter the following to run ssh in verbose mode:

[local]$ ssh -v user@example.com

Check the output for your public key name. If the output indicates that ssh is looking for 'id_rsa' and you are using a custom key name, then this likely explains why you still cannot log in without entering your password. To remedy this, enter the following to add your custom key name:

[local]$ ssh-add ~/.ssh/customkey_rsa

DSA keys no longer function on servers running Bionic

Ubuntu Bionic runs SSH version 7.6p1. DSA keys are not available on this version.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?