HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   how use rsync as sudo to copy access_logs from remote server (http://www.howtoforge.com/forums/showthread.php?t=60808)

fantalimon 4th March 2013 22:14

how use rsync as sudo to copy access_logs from remote server
 
I'm trying to copy compressed access_log.gz files from /var/log/httpd from a remote server to a local one so that our marketing guy can download them.

There's probably a better way to do this... but this is what I have tried so far and having problem after problem

Have created a webuser account on both servers and added
webuser ALL=(root)NOPASSWD:/usr/bin/rsync at the bottom of /etc/sudoers file

In /home/webuser I placed this file called sync-log

ssh -t webuser@ipaddressofremoteserver rsync -varltpgzhP --rsync-path='sudo rsync' \/var/log/httpd/*.gz webuser@ipaddressofremoteserver:/var/www/html/accesslogs/A

When I run the file as webuser, this is the output:-

webuser@ipaddressofremoteserver's password:
sudo: invalid option -- -
protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(171) [sender=3.0.6]

I have generated and copied the keys from the remote server to the local, ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host. In the known_hosts file of the local server i see the key of the remote server listed, yet, when i run the sync file i'm still asked for the password... not sure why..

any guidance would be greatly appreciated.


All times are GMT +2. The time now is 04:40.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.