Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to set up rsync user to run a rsync script

Posted on 2016-07-14
2
Medium Priority
?
109 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

604 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