LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-05-2006, 05:07 AM   #1
keex
Member
 
Registered: Jun 2002
Location: Berlin / Germay
Distribution: gentoo linux, ubuntu
Posts: 40

Rep: Reputation: 17
Arrow ssh to multiple hosts behind remote nat


hello,

I would like to log in into multiple machines behind the firewall of a remote site. that means, that I connect to a remote router on different ports, delegating me to a different host behind that remote router.
the problem is that each server behind the remote router has a different ssh host key and I get the message
Code:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
...
is there a way of avoiding checks against the known_hosts file for a particular site?
 
Old 01-05-2006, 08:15 AM   #2
keex
Member
 
Registered: Jun 2002
Location: Berlin / Germay
Distribution: gentoo linux, ubuntu
Posts: 40

Original Poster
Rep: Reputation: 17
Lightbulb semi-solved

I sort of solved it... three scripts are now taking care of it... cheap, but works..
bin/hos-server:
Code:
#!/bin/bash
KH=~/.ssh/known_hosts
cat ~/.ssh/HOS_server_hostkey >> $KH
bin/hos-qube:
Code:
#!/bin/bash
KH=~/.ssh/known_hosts
cat ~/.ssh/HOS_qube_hostkey >> $KH
bin/hos-reset:
Code:
#!/bin/bash
KH=~/.ssh/known_hosts
SERVERKEY_QUBE=$(cat ~/.ssh/HOS_qube_hostkey | cut -d" " -f3)
SERVERKEY_SERVER=$(cat ~/.ssh/HOS_server_hostkey | cut -d" " -f3)

cat $KH | grep -v $SERVERKEY_QUBE | grep -v $SERVERKEY_SERVER > ${KH}_TMP
mv ${KH}_TMP $KH
 
Old 01-05-2006, 09:16 AM   #3
celejar
Member
 
Registered: Oct 2003
Location: New York
Distribution: Debian Sid
Posts: 185

Rep: Reputation: 30
The ssh_known_hosts file can contain multiple lines with the same hostname, i.e. different keys for the same hostname.

From the sshd(8) man page:

Quote:
SSH_KNOWN_HOSTS FILE FORMAT

The /etc/ssh/ssh_known_hosts and ~/.ssh/known_hosts files contain host
public keys for all known hosts. The global file should be prepared by
the administrator (optional), and the per-user file is maintained auto-
matically: whenever the user connects from an unknown host its key is
added to the per-user file.

Each line in these files contains the following fields: hostnames, bits,
exponent, modulus, comment. The fields are separated by spaces.

<SNIP>

When performing host authentication, authentication is accepted if any
matching line has the proper key. It is thus permissible (but not recom-
mended) to have several lines or different host keys for the same names.


This will inevitably happen when short forms of host names from different
domains are put in the file. It is possible that the files contain con-
flicting information; authentication is accepted if valid information can
be found from either file.
 
Old 01-05-2006, 10:34 AM   #4
keex
Member
 
Registered: Jun 2002
Location: Berlin / Germay
Distribution: gentoo linux, ubuntu
Posts: 40

Original Poster
Rep: Reputation: 17
yeah!
cool, thanks... it works now.

I didn't think of looking up the ssh daemon manpage... I did look up ssh_config, though, but didn't ever find any hints to my problem.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp/ssh tail(multiple file) remote copy tpreitano Linux - General 1 08-22-2005 02:17 PM
Multiple Machines behind single Static IP - failing remote ssh Animalector Linux - Security 8 08-18-2005 06:01 PM
execute multiple ssh remote commands tom221 Linux - Newbie 2 01-28-2005 01:00 PM
remote ssh commands on multiple hosts evilchild Linux - Software 6 08-12-2004 10:48 PM
BIND and /etc/hosts + NAT kilou Linux - Networking 0 07-13-2004 07:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration