0

A remote system generates statistics files every 5 minutes and places them in a certain directory. At any given time there are 1000+ files in that directory. Every 5 minutes I want to copy the newest file to my server for analysis. The problem I am having is that the files on the remote system are not readable by "all", and the remote sysadmin does not want to give me access to the login that can read them because that login has write permissions that I don't need.

The sysadmin doesn't mind giving me "read" access to the entire system.

I had been using this command successfully every 5 minutes:

rsync -az -e "ssh -tt" --rsync-path="sudo rsync" REMOTE_SYSTEM:/var/logs/ .

I don't have access to /etc/sudoers so I don't know the exact settings of "tty_require" and "tty_tickets". When I initially set it up -t didn't work but -tt did....not sure of the exact difference.

This command has worked for months until we upgraded our local server from Redhat5.11 -> CentOS6.6. Now I get an error:

tcgetattr: Invalid argument
unexpected tag 87 [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(1134) [receiver=3.0.6]

RSYNC version/protocol are the same across the upgrade on both servers. SSH version changed from OpenSSH_4.3p2 to OpenSSH_5.3p1 with the CentOS upgrade.

Google gave nothing for "tag 87". Changing sudoers on the remote system is difficult.

I am not wedded to this solution but it was working before the upgrade and met the requirements. If I can solve by tweaking the options on my side that is preferable to getting the sysadmin to make changes on their side. I suppose I can pull the RSYNC source and debug/patch around the issue, but tweaking options is a lot more desirable.

Other suggestions welcome!

DavidG
  • 113
  • 3
  • A possible reason for similar errors with rsync is output from the remote user's `.bashrc` file. However in this case agabrys's suggestion about `-tt` seems more likely. – Paul Haldane Aug 10 '15 at 20:01

1 Answers1

0

I think you can not use ssh -tt with rsync.

From RedHat Bugzilla (Bug 1019923, created 2013-10-16, answered 2013-10-17 by Pavel Šimerda):

I don't think tools like rsync are generally ready to transfer data over a pseudo terminal and I wouldn't expect it to work. The transfers rsync is doing are of binary nature and any layer that works with special characters naturally breaks that.

I am curious about the reason for using double '-t' as the meaning of that is to force TTY allocation even when it clearly doesn't make sense (e.g. the local side is a daemon that wants to transfer data, and not a terminal session).

Is there any reason to use '-tt' except to deliberately break any binary protocol over the SSH transport (e.g. for testing purposes)?

My only suggestion is to disable requiretty only for one user, see sudoers: how to disable requiretty per user.

agabrys
  • 101
  • 1
  • 4
  • It may be that `-tt` was needed because of a `requiretty` setting in `sudoers` on the remote machine. Fixing that should remove the requirement for `-tt` and so give a working solution. – Paul Haldane Aug 10 '15 at 20:00