Curl - Specify SSH private key file using the --key and --pass options
by
Jeremy Canfield |
Updated: June 24 2022
| Curl articles
By default, curl will use your /home/username/.ssh/id_rsa (if it exists) private key when attempting to establish a connection to an SSH or SFTP server. The --key option can be used if you want to use some other private key file.
curl --key example.key sftp://server1.example.com
If the private key file is secured with a passphrase, the --pass option can be used to include the passphrase.
curl --key example.key --pass itsasecret sftp://server1.example.com
Did you find this article helpful?
If so, consider buying me a coffee over at