2

I have git successfully installed on one of our Red Hat Linux 5 WS servers, and am using it on our Intranet, not outside our firewall.

Currently, I am prompted for a password when I connect, so what steps do I need to take to make sure the server has the correct keys to avoid prompting for a password? I believe this is an issue of making sure the public keys are present. I'm just not sure how to set that up.

3 Answers 3

2

Make a keypair, and then copy the public key to the server:

Example:

ssh-keygen -t dsa
ssh-copy-id -i ~/.ssh/id_dsa user@remotehost
3
  • ssh-copy-id on RHEL 5?
    – Peter
    Aug 21, 2012 at 19:14
  • @Peter Do you have a question? Aug 21, 2012 at 19:19
  • 1
    Still being prompted for password after logging out and back in. Aug 21, 2012 at 19:50
3

OK, it's easy. A is the client, B is the target machine. You login on A with your credentials. You generate the ssh key (if you do have it, ignore that step):

ssh-keygen -t dsa

Defaults are OK. You know have a file ~/.ssh/id_dsa and a ~/.ssh/id_dsa.pub Login on B and execute the commands:

mkdir ~/.ssh
chmod 700 ~/.ssh

Go on A again and scp the key file:

scp ~/.ssh/id_dsa.pub <username_b>@B:~/.ssh/authorized_keys

where is the username of B. Go on B and execute the command:

chmod 600 ~/.ssh/authorized_keys

Now, you should be OK.

2

Check the /etc/ssh/sshd_config file that the option

PubkeyAuthentication yes is set.

Also, I forgot to answer if you try with the root account. In that case, you need to setup the option PermitRootLogin as

PermitRootLogin without-password

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.