If ssh-copy-id or the Mac OS X command does not work on your Linux machine
- Follow step one in the previous section to create the keypair on your home computer.
- If ssh-copy-id doesn’t work for you, then 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:
[server]$ scp ~/.ssh/id_rsa.pub email@example.com:~/
This copies the id_rsa.pub file on your home computer to your DreamHost SHELL user.
- Log into your DreamHost server through your SHELL user.
- Once logged into your DreamHost server, you’ll need to append the public key you just uploaded to your authorized_keys file. To do this, first make sure you’re in your users directory:
[server]$ pwd /home/username/
- In that directory, create the /.ssh folder:
[server]$ mkdir .ssh
- 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
- Remove the original id_rsa.pub file in your SHELL user’s directory:
[server]$ rm id_rsa.pub
- 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 firstname.lastname@example.org
For more information, see the man pages for ssh, ssh-keygen, ssh-copy-id, and sshd. “Getting started with SSH” is a step-by-step tutorial which you may find helpful.
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.
- 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:
[server]$ eval `ssh-agent`
- ssh-agent is a program that handles passwords for private keys.
- Run the following to add your private key to ssh-agent:
- Enter your private key password (if you created one).
- Enter the following into your .bash_profile or .bashrc file to kill the ssh-agent when logging out.
[server]$ 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:
[server]$ ssh -v email@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:
[server]$ ssh-add ~/.ssh/customkey_rsa