43 lines
762 B
Markdown
43 lines
762 B
Markdown
---
|
|
title: "SSH Key Access"
|
|
author: "Hyperling"
|
|
date: "2025-11-13"
|
|
tags:
|
|
- "tech"
|
|
categories:
|
|
- "guide"
|
|
series:
|
|
- "server administration"
|
|
---
|
|
|
|
How to set up an SSH key and use it to access a remote machine.
|
|
|
|
### Generate Key
|
|
|
|
``` bash
|
|
ssh-keygen
|
|
```
|
|
|
|
### Copy the Key
|
|
|
|
``` bash
|
|
ssh-copy-id [-p port_nbr] username@server_or_IP
|
|
```
|
|
|
|
So this may look like one of the below.
|
|
|
|
``` bash
|
|
ssh-copy-id sftp@12.34.56.78
|
|
ssh-copy-id -p 2222 leethaxor@pwnnoobs.pro
|
|
```
|
|
|
|
### Profit
|
|
|
|
Now you should be able to log in or copy files without needing to type a password.
|
|
|
|
```
|
|
ssh [-p port_nbr] username@server_or_IP
|
|
scp [-P port_nbr] username@server_or_IP:file_to_pull local_path_to_save
|
|
scp [-P port_nbr] local_path_to_send username@server_or_IP:remote_path_to_save
|
|
```
|