[release] sFTP backups for DirectAdmin (version: 0.1.poralix)

Hi Guys,

Im getting this error:

[ list ] sftp return code: 255
ssh: connect to host ********* port 3726: Connection refused
Couldn't read packet: Connection reset by peer
FTP information invalid.

I changed the files with the 3726 port (it does says sftp return code) so that was all good. When I connect with FileZilla to the IP with that port, it does connect. With DirectAdmin backup it gives the above error message.

Does anyone have any idea what the problem might be?

Thank you in advance!
 
With backups to SFTP you should use a full path from the root of the server, i.e. Remote Path should be absolute /home/USER/backup_folder/, do not use relative /backup_folder/ for cases when it's located under /home/USER/ or similar, it is not FTP.

If it's not the case then kindly show details of your backup task (you might mask host/IP and username), do not mask other details though.
 
[ list ] sftp return code: 255
ssh: connect to host ********* port 3726: Connection refused

Make sure the port is opened in a firewall on your directadmin and backups server both IN and OUT.
 
Yep checked it just now:

Found outdated scripts under /usr/local/directadmin/scripts/custom/.

Yes, you've updated scripts under /usr/local/directadmin/scripts/custom/directadmin-sftp-backups/ but they also need to be copied to /usr/local/directadmin/scripts/custom/

I've upgraded the scripts on your server, and it seems to have solved the issue.

Please confirm.
 
Hi,
I am using synology nas for my backup server where i enabled root user.
I tried to use the synology root credentials in DA.

-The path looks like this: /volume1/backups/sites/
-Secure FTP is unchecked

I have also enabled the port 53400 on both servers and router and i modified the 3 files to:
Code:
+SSH_PORTS="22 2200 22022 53400";

Those 3 files are located at:
Code:
/usr/local/directadmin/scripts/custom/ftp_download.php
/usr/local/directadmin/scripts/custom/ftp_list.php
/usr/local/directadmin/scripts/custom/ftp_upload.php

I get this error in DA:
Code:
[list] sftp return code: 255
Could not create directory '/.ssh'.
Warning: Permanently added '[XX.XX.XX.XXX]:53400' (ECDSA) to the list of known hosts.
Connection closed
FTP information invalid.
 
Last edited:
Hello,

Try and add a new line with

Code:
set -x

in the scripts after
Code:
#!/bin/sh
run a backup

and post here all the details from directadmin.
 
I added the line:
Code:
#!/bin/sh
set -x
..to 3 files but still i get the same error.
I also rebooted the server just to be sure.

Btw, I am using Dashboard / Admin Backups in DA
 
The command does not intend to fix anything, I would expect it to make output more verbose.

You need to identify on why "Connection closed". Check remote server logs for possible details.
 
Ok i found one entry in DA server lfd.log:
Code:
Feb 14 21:25:06 host1 lfd[24253]: *SSH login* from XX.XXX.XX.XXX into the root account using password authentication - ignored

UPDATE: I discovered that i can't log in to my Synology with root user using putty. Maybe Synology has disabled root access for SFTP, thats why.

But i can log in with synology "admin" user and i was able to connect with SFTP protocol using WinSCP and also the DA admin backups works now with port 53400.
It's now interesting, i don't have root access with SFTP but i can log in to synology with root using SSH/putty.

Possibly, i should create new synology user "backup" and add root priviledges to it + SFTP access, but i am not sure how to do it and if thats a good idea.
 
Last edited:
Found outdated scripts under /usr/local/directadmin/scripts/custom/.

Yes, you've updated scripts under /usr/local/directadmin/scripts/custom/directadmin-sftp-backups/ but they also need to be copied to /usr/local/directadmin/scripts/custom/

I've upgraded the scripts on your server, and it seems to have solved the issue.

Please confirm.

Confirmed. I am Idiot. Thanks for fixing ! 🤨🙃
 
Is there a way to use rsync with this plugin? Its much faster protocol. Thanks!
 
sFTP can be managed by SSH (sshd) and FTP (proftpd) daemons. For rsync a clean SSH link is required, so it can not be used over sFTP.

Anyway you are free to modify the scripts to use rsync. ;)
 
Hey, Thanks for the reply, i would write the script here but i lack little bit of knowledge tho. :)

Would it be great if da would add SFTP and RSYNC additionally to the core and we can choose between them from the menu where the current options exist.

That's the dream.
 
Made the first steps, now only god knows when and how.

Let's vote.

Thanks for the votes!
 
@zEitEr can you update the script for the new backup extension .zst ?

Have a look at line 110 in the ftp_upload.php file and change .gz to .zst
Code:
FROM
cat ${DUMP} | grep -v '^sftp> ' | grep -E '(.*)\.tar(|\.gz)(|\.enc)$';

TO
cat ${DUMP} | grep -v '^sftp> ' | grep -E '(.*)\.tar(|\.zst)(|\.enc)$';

That will allow you to restore an account using DA backup/restore option. However, changing the code will only display .zst files and not many existing .gz.
 
Back
Top