Rsync over SSH - disable StrictHostKeyChecking
by kzo81 from LinuxQuestions.org on (#6QBSJ)
Hi,
Could you help me out a bit? I still got a prompt when I run the rsync script, however I modified the config file this way:
/home/root/.ssh/config:
Code:Host A.B.C.D
StrictHostKeyChecking no
UserKnownHostsFile /dev/nullThese are the commands that I was experimenting ( I use a dropbear key):
Code:rsync --remove-source-files -avme "ssh -i "$ssh_key" -p $ssh_port" "$src" "$dst"
rsync --remove-source-files -avme "ssh -i "$ssh_key" -o StrictHostKeyChecking=no $ssh_ip -p $ssh_port" "$src" "$dst"
rsync --remove-source-files -avme "ssh -i "$ssh_key" -o StrictHostKeyChecking=no $ssh_user@$ssh_ip -p $ssh_port" "$src" "$dst"This command should run with cron, and whenever I run it, first it ask for a "YES" to add to the known_hosts file:
Code:
ssh: Ignoring unknown configuration option 'StrictHostKeyChecking=no'
...
Host '1.2.3.4' is not in the trusted hosts file.
(ecdsa-sha2-nistp256 fingerprint md5 3b:b4:XXXXXXXXXXXXXXXXXXXXXXXXX:bc:d4:46:d2)
Do you want to continue connecting? (y/n)
Could you help me out a bit? I still got a prompt when I run the rsync script, however I modified the config file this way:
/home/root/.ssh/config:
Code:Host A.B.C.D
StrictHostKeyChecking no
UserKnownHostsFile /dev/nullThese are the commands that I was experimenting ( I use a dropbear key):
Code:rsync --remove-source-files -avme "ssh -i "$ssh_key" -p $ssh_port" "$src" "$dst"
rsync --remove-source-files -avme "ssh -i "$ssh_key" -o StrictHostKeyChecking=no $ssh_ip -p $ssh_port" "$src" "$dst"
rsync --remove-source-files -avme "ssh -i "$ssh_key" -o StrictHostKeyChecking=no $ssh_user@$ssh_ip -p $ssh_port" "$src" "$dst"This command should run with cron, and whenever I run it, first it ask for a "YES" to add to the known_hosts file:
Code:
ssh: Ignoring unknown configuration option 'StrictHostKeyChecking=no'
...
Host '1.2.3.4' is not in the trusted hosts file.
(ecdsa-sha2-nistp256 fingerprint md5 3b:b4:XXXXXXXXXXXXXXXXXXXXXXXXX:bc:d4:46:d2)
Do you want to continue connecting? (y/n)