CURL for SFTP with private key authentication

I need to upload files via SFTP with a PHP script. I think cURL probably is, because I have it available on the server.

Does anyone have an example of using cURL for SFTP using authentication with an identity key?

- EDIT -

I just noticed that HTTP PUT might be an alternative, but how safe is that?

+3
source share
1 answer
curl -u <username>: --key ~/.ssh/id_rsa --pubkey ~/.ssh/id_rsa.pub sftp://<remote_host>/<remote_path>

HTTP is not secure, so any data that you send during PUT (for example, the password or files that you upload) could be viewed and read in text form. Depending on your application, this may or may not be a problem for you.

+4

Source: https://habr.com/ru/post/1754702/


All Articles