Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given my default consumer-grade internet, I forwarded different ports on my router to different servers, however, known_hosts complains every time I log in. Can I tell it to distinguish by port?

Offending key for IP in $USER/.ssh/known_hosts:42
Matching host key in $USER/.ssh/known_hosts:50
Are you sure you want to continue connecting (yes/no)? yes

Can I do this without disabling CheckHostIP?

share|improve this question
dunno if relevant but you can configure ssh to listen on a few ports. on that line in sshd_config says something like listen 22 or port 22 or something, you can add other ports there. or other lines that say listen xx or whatever. worth looking into perhaps – barlop Mar 18 '13 at 18:46

A similar question was asked here:

How to edit known_hosts when several hosts share the same IP and DNS name?

and the top answer references the a question here:

How to handle ssh host key verification with 2 different hosts on the same (but changing) IP address?

It more or less appears to be aliasing the different instances of SSH to keep them separate and ignoring the IP address.

share|improve this answer
Yeah, I already do the aliasing. But I don't like the CheckHostIP part. – Reactormonk Mar 18 '13 at 18:43
I'd imagine you could ensure all servers have the same host key, but of-course that decreases your security. – davidgo Mar 18 '13 at 22:14
@Tass: since you're port forwarding from your router (which I assume is on your local network), I fail to see how CheckHostIP=no would really decrease your security when you do have host key checks in place (which adds real security). – eldering Mar 28 '13 at 22:03
@eldering It does when I'm accessing the hosts from the internetz. – Reactormonk Mar 28 '13 at 22:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .