rsync from remote SSH Server

Status
Not open for further replies.

jackydany

Explorer
Joined
Mar 17, 2014
Messages
51
Hello,

i am configuring my FreeNas to act as a BackupMaschine as well.
I just set up da PUSH Rsync module to a OpenMediaVault machine in my network.
Needs to be tuned, but working so far.

Now i want to backup my Webserver. This should be via SSH.
I want the Freenas to Pull the files, so i want to schedule everything from the Freenas, not the webserver.

I read the articles about SSH and rsync but i am still confused.

From where to where do i have to exchange the keys?

Freenas should GET/CATCH the Files from the Webserver, so its correct that this is the PULL side?
The webserver will be the PUSH side, right?

Would be nice if you could just tell me how to get it done maybe by an example.

My Freenas 192.168.1.150
My Webserver www.mydomain.de
directory on the webserver to be backed up /var/*
Directory on the Freenas /mnt/date/Backup/webserver/

Thanks in advance
 

Alvin

Explorer
Joined
Aug 12, 2013
Messages
65
Using the command line, that would be:
rsync -a --delete -e ssh username@www.mydomain.de:/var/ /mnt/date/Backup/webserver/
(username is the username on your webserver)

You can try this from the command line with the user you're intending to use. (That can even be root)
Create a keypair with the user you're intending to use on FreeNAS using ssh-keygen. Add the .pub keyfile to your webserver (in /home/username/.ssh/authorized_keys) If that file does not exist, create it and give it '600' permissions.

If that works you only have to translate it to the FreeNAS GUI.
 

jackydany

Explorer
Joined
Mar 17, 2014
Messages
51
Hi,

thank you.

Do i have to use root on the webserver (so generate a key for root on Freenas and use the root user on freenas as well?) to get access to all files?

Thanks
 

Alvin

Explorer
Joined
Aug 12, 2013
Messages
65
Not necessarily. If you are generating a key pair on FreeNAS for the root user, it will automatically be used for that user. They key pair does not care. (You can call ssh with the '-i' option to indicate what private key you want to use.)
The place where you add the public key is what counts. For example, if you have a user 'www' on the webserver, and you add the key to the home directory of the www user (/var/www/.ssh/authorized_keys maybe?), then you can
You will want to choose a username on the webserver that can read all the files you want to backup, so www might be a good choice if that is the user used by your http server.

Try from the command line to test. Remember that rsync has a --dry-run option for this.
 

jackydany

Explorer
Joined
Mar 17, 2014
Messages
51
Hi,

thank you!
Sounds good. Also i know the dry-run option but i am just starting with rsync, so before configuring i start with asking to do the right thing :D

am i right? :
i generate a key pair with user root on freenas (run ssh-keygen on freenas as root)
copy the pub key to the WebServer to /root/.ssh

Now configure rsync over ssh in FreeNas by using local root and remote host: root@remote-server.com correct?
remote path the path on the webserver i want to backup?


Thankys fot your patience :D
 

jackydany

Explorer
Joined
Mar 17, 2014
Messages
51
So its correct, generate ssh-keypair on FreeNas with root user and copy the pub to the remote-webserver to .ssh and add it there to authorized keys yes?
Not the other way around, genereate the keypair as root on the webserver ?

Sorry, and thanks :D
 
Status
Not open for further replies.
Top