Link to home
Start Free TrialLog in
Avatar of Pete Long
Pete LongFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Rsync From VPS (CentOS) to Cygwin

{Disclaimer - I'm weak on Linux Don't assume I know something Basic!}

OK, I've been trying to get this sorted for a while, at the moment Ive got the whole thing running in ESX, until I work out how to do it, then I will replicate it on my live Web Server.

My Goal: To Be able to backup my complete VPS Linux Server running CentOS6, via Rsync to a Windows machine. So that it will connect (without prompting for a password) and backup the entire VPS.

How far I've got:

I've installed Cygwin (installed openssh, rsync, bash)
I've generated an ssh key - and I can scp the public key to the web server
I've create a user on the web server (default shell = bash)

I've spent a looong time reading articles on this, and I cant work out where the ssh key should be generated, where the public key needs to be copied to, how to get either machine to trust the other machines public key.

Can anyone help nudge me forward?

Thanks
Avatar of xterm
xterm

All you need to do is copy the public key that you generated with ssh-keygen (id_dsa.pub or id_rsa.pub) to the .ssh directory of the user that you will be logging in as on the Cygwin/Windows server and name it authorized_keys.

The first time you ssh to the Windows server you will be prompted to accept and save the server's key.  It should then allow you in without a password, and all future logins should be promptless.

I'm thinking perhaps you did this in reverse - the public key needs to be generated on the server that will be doing the copying, so let's call it the client (aka, your Unix VPS)

Keep in mind that you need to run ssh-keygen as the user who will be doing the copy, which generates id_dsa.pub (if you used the "-t dsa" option) or id_rsa.pub (if you didn't specify.)  That will be the file that needs to be copied to the server side, and renamed to authorized_keys.

Please retry and let me know if/where you get stuck.
Avatar of Pete Long

ASKER

Ahh OK - I'm trying to do it the other way round, I want to instigate the copy from the Windows machine, via a simple script like this

So I've created, the id_rsa.pub  like so.....

User generated image
Created a user on my Web server like so...

User generated image
Coped the over the file from the widows machine like so..

User generated image
So using your example  - I would need to move that file (on the web server into the backupusers .ssh directory? (Im assuming this would be in that users home drive?) And finally rename id_dsa.pub to authorized_keys?

Then I can login from the windows box and instigate an rsync?

If I set the target to '/' will it replicate the ENTIRE Server?

Thanks for your help by the way :)

PL
ASKER CERTIFIED SOLUTION
Avatar of xterm
xterm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
FYI, I should mention that you CAN rsync in the direction you intended, but I think it's much cleaner to push the files from the source to the destination, especially since the source Unix machine has an easy scheduler already running - crond.

Good luck!