2

I usually have to access a couple of remote and local SSH hosts, this works perfectly, I actually want to have to type in the passphrase every time.

However, there's a single SSH host on my local network that I have to log into a lot more frequently than the rest. Security is not much of a problem with this one in particular, although connecting without keys is out of the question. Is there any kind of configuration which would allow me to not enter the passphrase for this single SSH host?

I hope I'm not asking something that doesn't even make sense...

Thank you.

Edit: I apologize for not clarifying, every server and my client are running Linux, there's no other OS involved in any way.

elpato
  • 145
  • 1
  • 7
  • I had actually seen that question before, but I think my case is different. I do want to be requested for the passphrase every time I try to log into any of the servers, except for this particular one on my local network. – elpato Jan 21 '16 at 00:50
  • Oh, that was stupidly easy... I can't believe I didn't think of something like that. If you want to write that as an answer I'll accept it. Thanks! – elpato Jan 21 '16 at 01:08

3 Answers3

2

This answer assumes that both servers are Linux servers. On one server you want to log on to frequently, use this as root (as security is not a factor):

ssh-keygen -t rsa

Give the file a new name (e.g., /root/.ssh/new_rsa.pub). I suggest this because if you accept the default and other people were using the public key for root on other servers, they won't be able to if you overwrite the file. Press enter at the next two prompts for a password. Then print the content of the file with this:

cat /root/.ssh/new_rsa.pub

Copy the output of the above and paste it in this file (create if need be or append if the file already exists) on the servers that you want to jump from (to log into the special server):

/root/.ssh/authorized_keys

Going forward, just use the content of the new_rsa.pub file and paste it into the "authorized_keys" file on other servers. When you are root on those other servers, you won't be challenged for a password when you ssh to it.

Jakuje
  • 21,357
Kiran
  • 323
  • But then I'd have to login as root, is that right? Even though security is not that important for this particular host, root login has been disabled on all of them. – elpato Jan 20 '16 at 23:57
  • @elpato Nope, generate the key with your own user, /root is just an example. – KireinaHoro Jan 21 '16 at 01:37
  • You could do the above but substitute root with the user of your choice. – Kiran Jan 26 '16 at 01:30
2

It sounds like you want to use two different sets of keypairs. Have one prompt you for your password every time, and set up the other one to be passwordless. Copy the passwordless set's public key to the server (or servers) you want to connect to more quickly.

0

The standard way is to set up public key based authentication. It takes a little bit of work and you can find a lot of great tutorial on the net.
But if you use PuTTY as SSH cient, you can pass the password as a parameter. You can create a shortcut to PuTTY.exe then edit the shortcut to add all required parameters, so that clicking on the shortcut will login to the remote host immediately. Here's an example:

enter image description here

SparedWhisle
  • 3,668