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

Active8

Verified User
Joined
Jul 13, 2013
Messages
593
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.
Hi , I don't have any problems, it was more a request for the author to change his code on the github
Personally I don't think this is the right approach, I have altered ftp_list.php like:
Code:
cat ${DUMP} | grep -v '^sftp> ' | grep -E '(.*)\.tar(|\.zst)(|.gz)(|\.enc)$';
I can see al my backup extensions old and new one Tested with backup and recover and it works fine
 

LeonDynamic

Verified User
Joined
Sep 19, 2020
Messages
28
@Active8, my mistake I wrote ftp_upload.php in my reply and should have wrote ftp_list.php.

The approach used would depend entirely on whether you have older .gz backups or not. If you have both I would go with your approach.
 

Limpan

New member
Joined
Dec 10, 2018
Messages
2
Hi. Thanks for a great plugin. I've been using it for backing up a few servers over SSH with password authentication and it has been working great. I wanted to add SSH key authentication instead but having some issues and can't seem to get it to work.

What I've done is that I've added SSH keys generated on the DirectAdmin server to the remote backup server and disabled password login on the remote backup server. Key authentication works on the backup server and I can connect to it without problems with one of the keys (my local computer).

When trying to create a backup from the DirectAdmin server I have added the following settings:

Server IP: xxx.xxx.xxx.xxx
Username: root
Password: /root/.ssh/id_rsa.pub (which is the path to the public key) and I've also tried /root/.ssh/id_rsa
Port: 22

But when running the backup I get an error message saying:

Code:
sftp return code: 255
Could not create directory '/.ssh'.
Warning: Permanently added 'xxx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.
root@xxx.xxx.xxx.xxx: Permission denied (publickey).
Connection closed.
Connection closed
FTP information invalid.

Is there anyone having an idea of why it's not working? Is there something I have missed? Could it be that DA can't read the key from the /root directory? Should I move the key somewhere else, and if so, where?

Thanks!
 
Last edited:

colorian

Verified User
Joined
Oct 19, 2018
Messages
6
I have posted an issue here. It seems there is a problem with permissions for the Private key. On clicking the "Schedule" or "Modify" buttons, it seems that the user "nobody" needs access to the private key. However when the backup actually runs and needs to be uploaded, it is the user "diradmin" that requires access. The only thing that has worked for me so far, is swapping the permissions from one user to the other in between.
 

Everterstraat

Verified User
Joined
Mar 21, 2015
Messages
25
Hi , I don't have any problems, it was more a request for the author to change his code on the github
Personally I don't think this is the right approach, I have altered ftp_list.php like:
Code:
cat ${DUMP} | grep -v '^sftp> ' | grep -E '(.*)\.tar(|\.zst)(|.gz)(|\.enc)$';
I can see al my backup extensions old and new one Tested with backup and recover and it works fine

A little correction, it ends with tar.gz or tar.zst and not on tar.zst.gz!
Bash:
cat ${DUMP} | grep -v '^sftp> ' | grep -E '(.*)\.tar(|\.enc|\.gz|\.zst)$';
But thanks for your addition very useful.
 

realcryptonight

Verified User
Joined
Nov 16, 2019
Messages
128
I am just trying to deploy your script on my new panel and I get the following error code:
  • sftp return code: 5
    Could not create directory '/nonexistent/.ssh'.
    Warning: Permanently added '**My local ip**' (ECDSA) to the list of known hosts.
    Permission denied, please try again.
    FTP information invalid.

    Does anyone know why this happens and how to fix it?
    And (incase this is relevant) I also have deployed this on my other DA install without issue.
 

realcryptonight

Verified User
Joined
Nov 16, 2019
Messages
128
I am just trying to deploy your script on my new panel and I get the following error code:
  • sftp return code: 5
    Could not create directory '/nonexistent/.ssh'.
    Warning: Permanently added '**My local ip**' (ECDSA) to the list of known hosts.
    Permission denied, please try again.
    FTP information invalid.

    Does anyone know why this happens and how to fix it?
    And (incase this is relevant) I also have deployed this on my other DA install without issue.
Update:
For now it seems like it just decided to work. But i still have no clue why. So if anyone can shed some light, that would be apriciated.
 

realcryptonight

Verified User
Joined
Nov 16, 2019
Messages
128
Does anyone know how i can add an SSH Key?
I see the script can use it but i have no clue how to set it up.
 

simplificare

Verified User
Joined
Jul 10, 2019
Messages
21
  • sftp return code: 3
    Failed to change pseudo terminal's permission: Operation not permitted
    FTP information invalid.
Hi @jamesf, did you ever resolve this?

I think I've narrowed it down to a permission issue with the admin user. I can run the sshpass command manually from the terminal as root, but not as admin.

Thanks,
Michael
 
Top