How to Enable Browsing when You Have SSH Access

view of tunnel

Introduction

If you have access to SSH into a machine, it means you have full control of that machine. However if not all of the things can be done via terminal SSH, sometimes you need to browse some sites using that machine connection. The simplest solution for this is to create an SSH tunnel.

SSH tunneling is a powerful and secure way to browse the web anonymously and access restricted content. It allows you to route your internet traffic through a remote server using an encrypted SSH connection, providing both privacy and security. In this post, we’ll explore Dynamic Port Forwarding, a popular technique to enable secure browsing via SSH tunneling.

Prerequisites

Before we begin, ensure you have the following prerequisites:

  1. Access to a remote server with SSH enabled.
  2. A local machine with SSH client installed (usually pre-installed on most Unix-based systems).
  3. A web browser (e.g., Chrome, Firefox) for configuring the proxy settings.

Dynamic Port Forwarding (SOCKS Proxy)

Open a terminal on your local machine and use the following command to establish an SSH connection to your remote server. Replace username with your remote server username and remote_server with the server’s hostname or IP address.

ssh -D 8080 -C -N username@remote_server

The options used in this command have the following meanings:

  • -D 8080: Specifies the local port (8080) to act as the SOCKS proxy.
  • -C: Enables compression to reduce data transfer overhead.
  • -N: Tells SSH not to execute any remote commands (we only want to create the tunnel).

Authenticate and enter your SSH password when prompted. Then configure your browser. Open your web browser and go to its proxy settings:

  • Host/Address: 127.0.0.1 (localhost)
  • Port: 8080 (or the port you specified in the SSH command)

And there you have it! Your browser is now all set up to utilize the SSH tunnel as a SOCKS proxy, providing you with web traffic through a remote server! I hope this helps. 🙂

,

Leave a Reply

Your email address will not be published. Required fields are marked *