Solved

how to set up rsync user to run a rsync script

Posted on 2016-07-14
2
69 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 25

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
add some character at the end of line in vi 7 80
Can't ping New Linux Servers 40 68
linux SFTP 8 44
how to configure linux OS using Ubuntu 7 44
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

803 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