Rsync SSH to another server

#1

Hi.
Thanks for a great pack of software. I really enjoy learning how to use NextClouDPI

That being said, I cant wrap my head around how to ssh rsync to another server and then get my backup uploaded.
Is there a howto for this somewhere I might have missed?

#2

Your question is not Nextcloud related. Using ssh and rsync will be a question for any search machine.

#3

NCP provides nc-rsync and nc-rsync-auto
either through ncp-config or ncp-web


Here is the wiki’s configuration reference for rsync.

#4

I am facing the same problem, since there is nothing rsync related in the documentation.

I have a NextCloudPi an an Openmediavault and want to sync NCP to OMV.

#5

Really? I used the search field, typed “rsync” and got to this:
https://docs.nextcloudpi.com/en/configuration-reference/#nc-rsync

And while rsync is a unix tool which is only utilized by the NCP developer, there is plenty more documentation for rsync, ssh and so on on the Internet.

1 Like
#6

Oh thank you @Schmu.

I don’t get how to auto-login… Do I need to create RSA-keys and share the public key to NCP?

#7

The other way round. You need the public key on the backup device and the private key on your NCP, if you want to “auto-connect” to another server via SSH. There are several guides out there, which explain the key pair generation and where to put the files afterwards.
This guide here looks pretty good on the first glance:

Afterwards “auto login” is setup and you should be able to login with simple
ssh <user>@<backup server IP>

and your rsync can be configured and should work afterwards as well.

#8

rsync
type ssh keyauth into your se of choice; this ia a

general example on debian
GOOD LUCK!

#9

Thanks @Schmu

So finally I got this, automatic login works:

amilopowers@nextcloudpi:/home$ rsync -e 'ssh -p 22' -av /home/amilopowers/ root@192.168.1.51:/NextcloudPi
sending incremental file list
created directory /NextcloudPi
.
.
.
.
sent 12,909 bytes  received 283 bytes  8,794.67 bytes/sec
total size is 11,937  speedup is 0.90
amilopowers@nextcloudpi:/home$

When I then try to start rsync from the weg panel i get this:

[ nc-rsync ]
Maintenance mode enabled
Nextcloud is in maintenance mode - no apps have been loaded

ssh_exchange_identification: Connection closed by remote host
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.2]
Maintenance mode disabled
#10

I bet your Nextcloud user is different from user that you did test before (amilopowers) and he could not access you key. You have to specify it and it should be accessible for NC user. Added to rsync something like this (you do not need -p 22 because 22 is standard ssh port):

...-e "ssh -i <SSHIdentityFile>" <DirectoryToSync> <SSHUser>@<RemoteAddr>:<RemoteBackupFolder>

Here is an example: