I am able to SSH into an Embedded Linux device remotely using a private key with the following command as example (where id_rsa is the private key file):

ssh -i id_rsa [email protected] 

This will be authenticated on the device using the matching public key stored on the device.

What i'm wondering is, must a private key be used like when authenticating via SSH this way, or should vice-versa also work? hence private key on the device instead , but public key used in the SSH command to access the device?

1 Answer 1


No. Public keys are, surprise, public. As such, they can't be used for authentication because everybody can (and is expected to potentially) have it. Trying to use a public key for authentication is like broadcasting "the person who shows up at the White House with the number 3671 gets $1,000,000,000" on national TV, radio, and newspapers. You'd find that everybody with the ability to get themselves to D.C. is suddenly claiming they should be a billionnaire, and there's no way to tell which one was actually supposed to get the money. Similarly, allowing SSH (or any other) authentication with public keys results in everybody in the world being able to "authenticate" if they want to, and makes the entire concept of authentication a meaningless farce.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .