?
Solved

how to set up rsync user to run a rsync script

Posted on 2016-07-14
2
Medium Priority
?
102 Views
Last Modified: 2016-07-22
I have two application servers clustered behind a load balancer on aws. Both of them connect to a ldap server for authentication.

I have a rsync script to run on the second application server to sync the cache folder from the first server. I can run the rysnc script under root user without problem. But how can I add it to cron job to run it automatically. Do I need a special user to run it or I can run it under "root" user?

Also, I think I need implement keyless ssh authentication. How could I do it?

thanks.
0
Comment
Question by:Jason Yu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 2000 total points
ID: 41711355
Hi!

You can run a cron job under root user as well as any other user.
To create and edit a cronjob you simply issue
crontab -e 

Open in new window

to list the cronjob of a user the you simly issue
crontab -l 

Open in new window

See further examples here

To setup ssh keyless login look here

Regards,
    Tomas Helgi
0
 

Author Comment

by:Jason Yu
ID: 41711495
I got the following error after I copied the id_rsa.pub key to the authorized_keys file on the remote host.


[root@magentoprod-apache1 .ssh]# rsync -a /var/www/html/var/cache/ root@10.104.1.24:/var/www/html/var/cache
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(605) [sender=3.0.9]
[root@magentoprod-apache1 .ssh]# ls -alth
total 20K
drwx------. 2 root root   76 Jul 14 15:11 .
-rw-------  1 root root  953 Jul 14 15:11 authorized_keys
-rw-------  1 root root 1.7K Jul 14 15:06 id_rsa
-rw-r--r--  1 root root  406 Jul 14 15:06 id_rsa.pub
-rw-r--r--  1 root root  173 Jul 12 14:51 known_hosts
dr-xr-x---. 4 root root 4.0K Jun 23 10:03 ..
[root@magentoprod-apache1 .ssh]#
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question