I want to use SSH between two computers on the same domain with the same user, and I don't want to type the password. here's an example:
[user@pc1 ~]$ ssh pc2
if pc1 and pc2 are on the same domain, with NIS authentication, and I'm logging in through SSH with the same user (as I didn't specify one), I wish I didn't have to type the password again, as I already did it when logging in at pc1.
Under no circumstances should you blindly trust a network connection to be who they say they are. Instead, what you can do is set up SSH keys. By distributing the public key to all the servers you want to SSH into, and the private key to those trusted computers you want to SSH from, you can get the same thing with some amount security.
Normally you should give a private key a password, to prevent disclosure, but if you make a key-pair exclusively for network authentication, it should suffice.
Your simplest path to success is with public keys.
Look in your home directory, under .ssh and see if you have id_dsa or id_rsa (and an accompanying .pub file).
The id_dsa (or rsa) is your private key. The .pub is your public key. It's a text file, so you can cat it.
Note - if you don't have these, you can create them with the ssh-keygen command.
On the other machine, cd to the .ssh directory, and edit a new file called "authorized_keys". Paste the contents of the .pub file into this (it's all one big line).
Do the same thing for the other machine, just in reverse.
Just to make sure permissions are right, run "chmod 600 ~/.ssh/authorized_keys" on both machines.
At this point, you should be able to ssh without passwords from one machine to the other.
The easiest way to set up auth with SSH keys is as follows.
If you're using SSH public/private keys (and you should IMHO) and you're using some kind of SSH agent, like
ssh-agent(1)
, log to pc1 with-A
flag, like:This will also allow you to use agent forwarding to connect to other accounts (not necessarily with the same username), as long as your public key is propagated to given accounts@hosts.
It is possible (depending on your ssh client) to setup keys for the entire host, instead of keys for individuals. I have never used this, but there are some related links.