Configuring ssh not to prompt for password
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.
Solution 1:
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
Solution 2:
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.
Solution 3:
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