# Using a SOCKS proxy with OpenSSH

#### Setting up a SOCKS5 proxy using OpenSSH client command line

In order for this to work, the remote SSH server you're connecting to must have

```bash
ssh -D 1337 -q -C -N user@domain.com
```

Here's the options breakdown:

1. `-D 1337` opens a SOCKS proxy on local port 1337. You can specify any port number you would like.
2. `-c` enabled data compression in the tunnel, saving bandwidth
3. `-q` enables quiet mode
4. `-N` is to just forward ports, don't execute any remote commands

Once you've tested and verified that everything is working properly, you can add the -f option to fork the process to a background command.

```bash
# -f = fork to background
ssh -D 1337 -q -C -N -f user@domain.com
```

Using the SOCKS5

#### Setting up a SOCKS5 proxy using OpenSSH client config file

The configuration options `DynamicForward` is synonymous with the `-D` option and can be added to your `~/.ssh/config` file:

```
Host example.com
    User username
    DynamicForward 8080
```

-end