[SOLVED] Connecting between nodes

NET6a

New Member
Feb 3, 2015
5
0
1
Hello,

i am trying to do a script that will make some actions between different nodes of a cluster, i need to launch some action.

when i try to connect, i get this message :
root@S2P-PMX01:~# ssh S2P-PMX02
Warning: the ECDSA host key for 's2p-pmx02' differs from the key for the IP address '172.16.2.102'
Offending key for IP in /etc/ssh/ssh_known_hosts:4
Matching host key in /root/.ssh/known_hosts:6

Are you sure you want to continue connecting (yes/no)? yes
Linux S2P-PMX02 2.6.32-34-pve #1 SMP Fri Dec 19 07:42:04 CET 2014 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Feb 2 13:05:15 2015 from s2p-pmx01.xxxxxxxxxxxxxxx
root@S2P-PMX02:~#

My problem, is that login require manual action, wich is incompatible with a automated script. Any idea on how to circumvent this ?

Serge

Special thanks to Remark,

connecting with IP address solve this problem, i know how to search a solution

Serge
 
Last edited:
Hello, i have already made this. It's like 2 (or more) certificates exist.

I try also with another login, same behaviour

Serge
 
You are probably right, but how can i force connection to avoid this message ?
 
Probably, you have to remove corresponding lines in files:
Offending key for IP in /etc/ssh/ssh_known_hosts:4
Matching host key in /root/.ssh/known_hosts:6

Then connect again to save new generated keys.
 
Last edited:
Please describe the solution, so people can find it.

I just change Machine name to IP address (in BOLD, into the script behind)

in the script

#!/bin/bash

# Backup Proxmox Qemu servers by duplicating disk on another storage
# (C) 2015 Serge NOEL <serge.noel@net6a.com>
# File under GNU GPL Licence

# Variables to edit
# Define server name here
Nodes="S2P-PMX01 S2P-PMX02 S2P-PMX03 S2P-PMX04"

#########################################
# Nothing to configure behind this line #
#########################################

# Duplicate /etc/pve configuration TODO

echo -n "Backup started : "
date +'%Y-%m-%d at %H:%M:%S'

for i in $Nodes
do
echo -n "Scanning server : $i"
IP=`ping -c 1 $i | grep PING | cut -f 2 -d '(' | cut -f 1 -d ')'`
# Due to SSH we have to connect with IP address instead of machine name
echo " $IP"
for j in /etc/pve/nodes/$i/qemu-server/*.conf
do
Name=`cat $j | grep name | cut -f 2 -d : `
FileName=$(basename $j)
FileName="${FileName%.*}"
echo -n " Found$Name ($FileName) : "
# Only running virtual machines are backuped
Running=`ssh $IP "qm list | grep $FileName | grep running"`
if [ "$Running" = "" ]; then
echo "Not running"
else
echo "Running"
echo " Launch ssh $IP 'qm copy_disk ...'"
fi
done
done
 
Last edited:
Probably, you have to remove corresponding lines in files:
Offending key for IP in /etc/ssh/ssh_known_hosts:4
Matching host key in /root/.ssh/known_hosts:6

Then connect again to save new generated keys.
Thank you worked better than running the ssh-keygen command :)