Psychz - Girish
Votes: 0Posted On: Jan 09, 2018 06:33:58
Hi!
This error occurs when you are trying to connect to a remote server with "ssh". While connecting through SSh, a key pair is generated in the local host and copied on to the remote host for authentication. The SSH keys are used to establish a secure connection between the local and remote host. After setting up the SSH key, you can connect to the remote server without the password as the SSH key is secure enough and troublesome to decipher. Sometimes, the key is not copied completely or to the right destination.
Please go to the following link to generate an SSh key pair and copy it to the remote machine.
https://www.psychz.net/client/question/en/generate-ssh-key.html
Here are some of the reasons due to which this error can occur.
1. Make sure that the public key you generate in the local host is copied to the remote host. The remote host identifies your machine with the same key pair. Please use the following command to copy the key to the remote host.
ssh-copy-id username@IP_address
2. Check the permissions on your remote host. You could be logging in as "root" but may not have the right permissions to log in. "/root", ".ssh" and authorized_keys all should be associated with the user "root".
Please use the following command to grant permissions.
chown -R your_user:your_user .ssh
3. You might be using the wrong key to connect to the remote machine. Another reason might be that you changed the key name. restore the key to default name and use the following command to connect with the right key.
ssh -i ~/.ssh/private_key username@host