Solved

how to set up rsync user to run a rsync script

Posted on 2016-07-14
2
59 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
2 Comments
 
LVL 24

Accepted Solution

by:
Tomas Helgi Johannsson earned 500 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Utilizing an array to gracefully append to a list of EmailAddresses
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.

759 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now