Backups to an SSH destination with SSH key auth

I have a server that I can backup to, at the moment I have Virtualmin do a backup to a local directory then a cron job scp the backups to the foreign server. The server is a backup service that I pay for and allows auth only via ssh keys. ( I cannot use username/password )

I have tried variations of settings within Virtualmin’s backup to try and get it to backup there directly using the SSH settings but no luck, Always access denied.

It it possible to do this?

I have tries sshfs but I can’t get it to work, some problem with fuse. (yet another issue!)

Sure, you can do that.

You would just need to make sure your private key was in the .ssh dir in the home directory of whatever user is sending the backups to the backup server.

So, if you’re having Virtualmin send the backups to your server, you’d need to make sure the private key was in the root users home directory.

To test that – log into your server as root, and make sure you’re then able to SSH into your backup server without a key.

-Eric

I have my SSH key’s set already and I can connect to my backup server with scp or rsync over ssh without a key, but I cannot ssh as my login is restricted to file transfer only. (my shell is nologin)

Currently I run the backup in Virtualmin locally then have a command after backup that rsync’s the directory to the backup server using rsync over ssh.

If I use the same details in the Virtualmin backup when I run it still it says permission denied

(Obviously in the following I have substituted my real settings.)

the following command on my server (ssh’d in as root) works fine:

scp test.file myremoteusername@mybackuphost.net:current/cygdrive/m/backup/

this copies the file with no prompt for password

If I set the following in a Virualmin backup:

SSH Server: mybackuphost.net

File on Server: current/cygdrive/m/backup/

Log in as User: myremoteusername

Password:

I get: Failed to connect to SSH server : scp: virtualmin-copy-test.myremoteusername: Permission denied