> For the complete documentation index, see [llms.txt](https://hacking-3.gitbook.io/barre/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-3.gitbook.io/barre/apuntes/general/redes/protocolos/ssh.md).

# SSH

It is a remote management protocol that allows users to control and modify their remote servers over the internet through an authentication mechanism.

**Port 22**

## **Usage**

### Connects to the remote server

```bash
ssh user@host
```

### Connect via a specific port

```bash
ssh -p port user@host
```

### **Connect using an SSH key**

```bash
ssh -i ssh-key user@host
```

{% hint style="info" %}
**Private key location for root ->**  `/root/.ssh/id_rsa`
{% endhint %}

### **Create a dynamic tunnel**

```bash
ssh -D 8888 user@host
```

{% hint style="info" %}
This option tells SSH to establish a dynamic tunnel through a local port acting as a SOCKS proxy. Network traffic will be routed from the client through the SSH server and then to the final destination.
{% endhint %}

### **Run SSH in the background**

```bash
ssh -f user@host
```

### **Enable data compression**

```bash
ssh -C user@host
```

{% hint style="info" %}
This can improve performance on slow connections or limited bandwidth.
{% endhint %}

### **Enable X11 session forwarding (graphical windows)**

```bash
ssh -X user@host
```

{% hint style="info" %}
Allows remote graphical applications to be run and displayed on your local machine.
{% endhint %}
