0

Hi I have an rsync shell script that synchronizes one host with a remote host:

#!/bin/sh
rsync -avz fqdn:/foo/dir1
rsync -avz fqdn:/foo/dir2
rsync -avz fqdn:/foo/dir3

The remote host permits the rsync without a password with ssh pre shared keys but only when the above script uses the fully qualified domain, if I reference the IP of the remote host like this,

#!/bin/sh
rsync -avz 192.168.1.1:/foo/dir1
rsync -avz 192.168.1.1:/foo/dir2 
rsync -avz 192.168.1.1:/foo/dir3

It will prompt me for a password for the remote host, why does it behave like this?

Ideally I want the IP reference in the case that the host can't resolve the remote host.

Arronical
  • 19,653
  • 18
  • 73
  • 128
jamieg
  • 80
  • 2
  • 10
  • Does your SSH client configuration set the keys used for the host? – muru Mar 03 '17 at 10:37
  • In the autorization file of the user@host (usually `~/.ssh/authorized_keys`) there might be the key option `from=`, which "Specifies that in addition to public key authentication, either the canonical name of the remote host or its IP address must be present in the comma-separated list of patterns." (see `man sshd`). – ridgy Mar 03 '17 at 15:25
  • @muru There is currently no ssh config so I will say 'no' – jamieg Mar 07 '17 at 15:34
  • @ridgy thanks for your input, it does make sense I see in 'authorized_keys' the hostname referenced next to the ssh key rather than the IP address! – jamieg Mar 07 '17 at 15:37

0 Answers0