# correct way to setup rsync between servers and running cron

## khinester

Hello,

I have two servers and on one of the server i have a user and have setup a ssh-keygen to access the first server.

When i run the following:

```
$ rsync -avz -e ssh user1@server:/home/user1/backup/ /home/user2/backup/
```

this works fine

i put this in a bash script and then tried to run it from cron, but i get these error

Permission denied (publickey,keyboard-interactive).

rsync: connection unexpectedly closed (0 bytes received so far) [receiver]

rsync error: unexplained error (code 255) at io.c(600) [receiver=3.0.6]

so i presume that the cron user is not able allowed to access this server.

how would i run the cron correctly so that i can login and rsync the data back to server2

i have vixie-cron running.

thanks

norman

----------

## Manko10

As which user do you run rsync? You have to set up your keyauth certificate for this user.

----------

