> For the complete documentation index, see [llms.txt](https://sarpers-organization.gitbook.io/ctftricks/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sarpers-organization.gitbook.io/ctftricks/_chapter-intro-7/ssh/key-based-authentication/trick-0361.md).

# Login via SSH with Stolen Private Key

***

To log in using a recovered SSH private key, use the `-i` flag with the `ssh` command. The `-i` option specifies the identity file (private key) to use for authentication. You provide the path to the private key file, the target user, and the target host.

The general command structure is:

```bash
ssh -i /path/to/private_key user@target_ip
```

For instance, if the private key `id_rsa` for the user `james` was found at `~/id_rsa` and the target is `10.10.139.53`, the command would be:

```bash
ssh -i ~/id_rsa james@10.10.139.53
```

This utilizes SSH key-based authentication to establish a session without needing the user's password.
