If ssh-copy-id or the Mac OS X command does not work on your Linux machine
On your home computer, make the keypair.
If ssh-copy-id doesn’t work, submit your public key to your GreggHost server directly. Run the following command on your home computer, using your login and the password you used to generate your key pair:
scp /.ssh/id rsa.pub [email protected]:/ [local]$ scp /.ssh/id rsa.pub [email protected]:/
This sends your home computer’s id rsa.pub file to your GreggHost SHELL user.
Use your SHELL user to access your GreggHost server.
You’ll need to add the public key you just submitted to your authorized keys file once you’ve signed into your GreggHost server. To begin, ensure that you are in your user’s directory. Make sure you use your Shell user’s username.
[server]
/home/username/ pwd
Create the /.ssh folder in that directory:
$ mkdir.ssh [server]
Create a new file named authorized keys in the new /.ssh folder with the following command. Your id rsa.pub file will be copied into this new authorized keys file as well:
[server]
.ssh/authorized keys >> cat id rsa.pub
Remove the original id rsa.pub file from your SHELL user’s directory by following these steps:
rm id rsa.pub [server]$
Make that the permissions on the /.ssh folder and the /.ssh/authorized keys. file are valid. Run the following three commands as the SHELL user:
[server]
/.ssh $ chmod 700
[server]
/.ssh/authorized keys $ chmod 600
If everything is set up correctly, you should now be able to log into your GreggHost account using SSH without having to enter a password. Run this command on your home computer, where the original keypair was established.
$ ssh [email protected] [server]$ ssh [email protected]
See the man pages for ssh, ssh-keygen, ssh-copy-id, and sshd for further details.
Unable to log in from Linux after the public key has been copied to your GreggHost server
After the key has been copied to your server, you should be able to log in right away. However, you may encounter the following problem when attempting to log in:
Error: The agent admitted that he did not sign the contract.
Use ssh-agent to keep your password in your current session to remedy this.
Run the following command to start ssh-agent. Make sure you use the backquote’character rather than a single quote – the backquote character is normally found on the tilde key on the top left of your keyboard:
[local]
eval $ `ssh-agent`
ssh-agent is a program that manages private key passwords.
To add your private key to ssh-agent, do the following:
[local]
ssh-add ssh-add ssh-add ss
If you provided your key a unique name when you made it, type it in here. Consider the following scenario:
$ ssh-add /.ssh/customkey rsa [local]
Enter the password for your private key (if you created one).
To deactivate the ssh-agent when logging out, add the following to your.bash profile or.bashrc file.
$SSH AGENT PID $SSH AGENT PID $SSH AGENT PID $SSH AGENT PI
You are no longer prompted for a password while connecting to your server using SSH.
Unable to log in from Mac OSX after the public key has been copied to your GreggHost server
It’s possible that you’re unable to log in automatically after uploading your public key because you’re using a keypair name other than id rsa/id rsa.pub because you’re using custom keypair names. When managing several keypairs, this is a regular occurrence.
To launch ssh in verbose mode, type the following:
$ ssh -v [email protected] [local]
Look for your public key name in the output. If the output shows that ssh is looking for ‘id rsa’ but you’re using a custom key name, that’s probably why you can’t log in without inputting your password. To fix this, type the following into the Custom Key Name field:
$ ssh-add /.ssh/customkey rsa [local]
DSA keys no longer function on servers running Bionic
SSH version 7.6p1 is installed in Ubuntu Bionic. This version does not support DSA keys.