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

Zelda

New member
Joined
Jan 27, 2020
Messages
1
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!
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
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.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
[ 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.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
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.
 

xerox

Verified User
Joined
Jul 16, 2019
Messages
93
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:

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
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.
 

xerox

Verified User
Joined
Jul 16, 2019
Messages
93
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
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
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.
 

xerox

Verified User
Joined
Jul 16, 2019
Messages
93
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:

spacecabbie

Verified User
Joined
Oct 11, 2019
Messages
103
Location
The Netherlands
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 ! 🤨🙃
 

xerox

Verified User
Joined
Jul 16, 2019
Messages
93
Is there a way to use rsync with this plugin? Its much faster protocol. Thanks!
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
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. ;)
 

xerox

Verified User
Joined
Jul 16, 2019
Messages
93
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.
 

xerox

Verified User
Joined
Jul 16, 2019
Messages
93
Made the first steps, now only god knows when and how.

Let's vote.

Thanks for the votes!
 
Top