Backup to SSH Server not working

I am trying to backup to a remote ssh server. I can use ssh and winSCP to connect to the remote server on port 2222. Freepbx seems like it is trying to connect on 22.

Initializing Backup 2
Backup Lock acquired!
Running pre-backup hooks…
Adding items…
Building manifest…
Creating backup…
Storing backup…
Warning: Identity file -l not accessible: No such file or directory.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
SSH Error (255) - Received [] from /usr/bin/ssh -o StrictHostKeyChecking=no -i -l pbx 1.1.1.1 -p 2222 'mkdir -p /backup/pbx/PBX_Full’
Warning: Identity file -P not accessible: No such file or directory.
ssh: connect to host 1.1.1.1 port 22: Connection refused
lost connection
SCP Error (1) - Received [] from /usr/bin/scp -o StrictHostKeyChecking=no -i -P 2222 /var/spool/asterisk/tmp/20170703-124922-1499100562-13.0.192.8-1550583711.tgz [email protected]:/backup/pbx/Lind_PBX_Full
Warning: Identity file [email protected] not accessible: No such file or directory.
ssh: Could not resolve hostname ls: Name or service not known
Running post-backup hooks…
Backup successfully completed!

@sentinelace

When you created the SSH Server in the Backup & Restore module there is a field for the remote SSH port. It defaults to 22, you should change that to the port you have SSH listening on.

it is listening on the correct port

Are you using an IP or a FQDN to connect with when you SSH? Hard to tell, I don’t think you’re using 1.1.1.1 as an IP though.

This is how I have it setup in the pbx. I can use Winscp and it works flawless. Is this incorrect?

New log shows:

July 17, 2017, 12:00 am - SSH Error (255) - Received [] from /usr/bin/ssh -o StrictHostKeyChecking=no -i -l lpbx x.x.19.22 -p 2222 ‘mkdir -p /backup/pbx/PBX_Full’
July 17, 2017, 12:00 am - SCP Error (1) - Received [] from /usr/bin/scp -o StrictHostKeyChecking=no -i -P 2222 /var/spool/asterisk/tmp/20170717-000002-1500264002-13.0.192.9-2145094751.tgz [email protected]:/backup/pbx/PBX_Full
July 17, 2017, 12:00 am - Running post-backup hooks…
July 17, 2017, 12:00 am - Backup successfully completed!

Looks to me like your lpbx user might not have permissions to the /backup/pbx/PBX_Full or /var/spool/asterisk/tmp directories…

Just a guess.

Were you ever able to get this ssh backup to work? I’m getting the exact same errors when I try

Nope. Never worked

I note that your screen shot has no ‘key’ entered, it wont work without one that is recognized by the destination server

@mvogel4949 @sentinelace

You need to add a key for the destination server.

Begin by creating a user and an SSH key on your warm standby server so that it can log in to the primary production server and transfer backups to itself.

Login to your backup server with an SSH client such as PuTTy, SecureCRT, or other SSH client.

At the prompt type: sudo -u asterisk ssh-keygen

Next we will copy the key to the primary server so that the backup server can SSH to the primary server without needing a password. Issue the command.

At the prompt type: sudo -u asterisk ssh-copy-id -i /home/asterisk/.ssh/id_rsa.pub root@PrimaryServerIP and enter the password when prompted.

APPLICATION NOTE

Make sure you replace the PrimaryServerIP with the IP Address of your primary PBX.

If this command completes without error, you are ready to test:

At the prompt type: ssh -i /home/asterisk/.ssh/id_rsa root@PrimaryServerIP

If all went well, you should now be logged in to the Primary server.

See this tutorial: https://wiki.freepbx.org/display/FPG/Warm+Spare+Setup

Also - make sure that the SSH user you are using has permissions to delete and create folders/files.