5

I'm now up to 4 SD cards with various version of Raspbian (Adafruit, Raspbian, Xbian, Raspbian Stripped Server), and I'm finding it annoying when I go to fool with another version that I have to edit my known_hosts file each time because each SD card has its own key.

I'm thinking there is no particular reason not to simply overwrite the id_rsa and id_rsa.pub in /root/.ssh/ with the same files on each card so that all of the cards match?

3 Answers 3

5

Do you mean when sshing into the RPi? In that case you need to copy the files in /etc/ssh.

I don't see any problem with doing that. The primary reason for those keys is to prove that the machine you think you are logging into is the machine you are logging into.

2

You can modify your ~/.ssh/config file on the client to not do the host key checking:

Host 1.2.3.4
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no

Replace 1.2.3.4 with the IP address of the RPi. This tells ssh to record the host key in /dev/null and to not ask about changed or missing host keys.

Of course has security implications so do this at your own risk.

1
  • You could but crippling host authentication for every system you connect to is far worse than using the same host keys on multiple systems all of which you trust. Commented Nov 27, 2015 at 14:08
2

There is no problem with overriding both server files (in /etc/ssh, like server key files) and client files (in your home directory ~/.ssh). You should however remember (in case you would copy whole directory or use some way of copying that won't preserve permissions) to set proper file/directories permissions (they should be the same as before copying). SSH may refuse to work when you have too broad file permissions (for your security).

Your Answer

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

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