If you want to use SFTP with the Admin Backup/Transfer in DirectAdmin

Use sudo -u diradmin /bin/bash, to test your custom ftp_upload.php script, not actually a PHP file, they like using the wrong extension, I was confused at first, till I saw the top line.

Turns out, I needed to run ssh without sshpass, so I could accept the fingerprint.

If only my backup provider supported FTPS or whatever it’s called.

Nice, looks like uploading works.

You could use plain FTP, and then everybody can see your password.

My ftp_list.php doesn’t work though. Or maybe when you click update files it’s using something else. You just have to make it not get 0 for the exit code.

You can just download the backups manually, to the VPS, and put it in the local backup folder. I didn’t modify the download script, just upload and list.

I could provide ftp_upload.php, but somebody said they’d do it for somebody for a fee. So I should sell it instead.

I figured out the problem with the list file. You aren’t supposed to use ${$POST}, just delete the brackets and extra dollar sign, or just delete the dollar sign in the brackets. But it still doesn’t work. Need to modify the part that awk.

So apparently if the script is invalid, it’ll continue backing up.

Haha, now it shows stuff, but just errors. Under files. It uses a different account for the listing apparently.

The username is nothing. Use id -u -n, the username is nobody.

echo "Username:" | /usr/bin/id -u -n > $DUMP;

That’s how I got the username.

Fixed it, create /.ssh, copy known_hosts into it, and then SFTP works. Still isn’t right though.

Maybe I’ll stay up till 5 am again. Now I’m determined to make the list work.

It sort of works, if you just use cat $DUMP. But shows everything from SFTP.

There we go, get rid of -v in the SFTP command. Oh, I think there’s debug logs after the file, so it’ll show up too. You’d need to match the last debug line, and not output it.

Now I just need to edit the download script. Maybe after I wake up. Or tomorrow, or the next day.