SSH Login with a Private Key
credentialstool
Summary
Authenticates over SSH with a discovered private key; the key file must have 600 permissions, and IdentitiesOnly forces use of the supplied key.
Walkthrough
Use a recovered SSH private key to log in as its owner.
Steps
- Save the key contents to a file (e.g.
id_rsa) and set strict permissions withchmod 600, or SSH refuses to use it. - Authenticate with
ssh -i id_rsa <USER>@<IP>. - Add
-o IdentitiesOnly=yesto force SSH to use only the supplied key when an agent offers others.
Commands
bash
nano id_rsa chmod 600 id_rsa ssh -i id_rsa <USER>@<IP>
bash
ssh -i root root@127.0.0.1 -o IdentitiesOnly=yes