0

I tried to use rsyncd to transfer projects from client to server (push operation). rsync (3.1.2) are installed and running on both client and server, with the server running rsyncd. The rsyncd.conf is as follows,

pid file = /run/rsyncd.pid
strict mode = false

log file = /var/log/rsync.log

[dir1]
comment = test folder dir1
path = /opt/dir1/
uid = user_name
gid = group_name
read_only = false

when I tried the following command,

rsync -aurv /path/to/dir1/ user@host_name::dir1

I got the following errors,

rsync: getaddrinfo: host_name 873: Temporary failure in name resolution
rsync error: error in socket IO (code 10) at clientserver.c(125) [sender=3.1.2]

The client and the destination server are connected through a bastion server. There is no issue if I just tried,

rsync -aurv /path/to/dir1/ user@host_name:/path/to/dir1

I am wondering how to fix the errors.

cheers

shgnInc
  • 1,634
  • 3
  • 21
  • 29
daiyue
  • 101
  • 1
  • 4

2 Answers2

2

Your failure is that the DNS lookup for host_name is failing, which is what the error tells you:

getaddrinfo: ... failure in name resolution

To fix this you could update your command to use the IP address instead, either:

rsync -aurv /path/to/dir1/ user@1.2.3.4::dir1

or for IPv6:

rsync -aurv /path/to/dir1/ user@[fe80::1]::dir1

Failing that you could add an entry to /etc/hosts to allow the name to resolve - or otherwise fix your DNS problems.

  • Hi, since we have a bastion server in between client and the destination server, so I defined an `ssh` port forwarding in `.ssh/config`. Since `rsync` is using `ssh` by default, and in `/etc/hosts`, I defined the external IP only for the bastion server. So I think using `rsyncd.conf` or normal `rsync` makes no difference. – daiyue Dec 22 '16 at 15:14
  • only the bastion server has external IP, the destination server only has internal IP, so how to specify the IP here in the command? – daiyue Dec 22 '16 at 15:36
  • 1
    Sounds like the simplest solution is to use `rsync` with SSH as the transport - ssh already knows how to reach your host via `~/.ssh/config`. So use `rsync -e ssh ...` and drop the use of `::`, just using a single colon. –  Dec 23 '16 at 07:14
  • I found single colon works as well, and so it makes `rsyncd.conf` no use then? or `rsyncd` is not working in `ssh` port forwarding? – daiyue Dec 23 '16 at 17:56
1

If you are using ssh for your rsync transport, you aren't using rsyncd to terminate the remote connection (which is the reference to TCP 873). Otoh if you are simply using a separate ssh tunnel to forward TCP 873 through to the rsyncd server on the inside, then your rsync client is actually going to connect to localhost and ssh will forward.

The double colon syntax is specifying the native rsync protocol (or rsync://). Without that, it will use the rsh/ssh transport method.

ckg
  • 109
  • 3