Setting up an SSH tunnel on MacOS allows you to securely route your internet traffic through a remote server. Here’s how you can do it:

  1. Requirements:

    • A remote server running SSH and capable of making outbound connections to the internet.
    • A user account on the remote server that can log in via SSH.
    • Access to the Terminal application on your Mac (located in /Applications/Utilities/Terminal).
    • Access to the Network section in System Preferences or an alternative browser (like Firefox) that accepts locally configured proxy connections.
  2. Setting Up the SSH Tunnel:

    • Open Terminal on your Mac (you can find it in the Utilities folder within Applications).
    • Execute the following command, replacing the placeholders:
      ssh -f -N -M -S /tmp/sshtunnel -D 1080 [email protected] -p22
      
      • Replace USER with the username on the remote server (preferably an unprivileged user).
      • Replace server.domain.com with the hostname or IP address of your remote server.
      • Adjust the port number (22 by default) if your remote server uses a different SSH port.
  3. Configure the Proxy Service:

    • Go to System Preferences > Network.
    • Select your active network connection (Wi-Fi or Ethernet).
    • Click “Advanced” > “Proxies.”
    • Check the box next to “SOCKS Proxy” and enter 127.0.0.1 for the SOCKS Proxy Server and 1080 for the port (the same as in the SSH command).
    • Click “OK” to save the settings.
  4. Using a Browser:

    • Open your preferred browser (e.g., Chrome).
    • Configure the browser to use the SOCKS proxy:
      • In Chrome, open a new tab and enter:
        chrome --proxy-server="socks5://127.0.0.1:1080" --host-resolver-rules="MAP * 0.0.0.0, EXCLUDE localhost"
        
      • This will direct your browsing traffic through the encrypted SSH tunnel to the remote server.

Remember that SSH tunnels are powerful tools for secure browsing, especially when dealing with restrictive firewalls or remote network issues

Was this answer helpful? 0 Users Found This Useful (0 Votes)

Powered by WHMCompleteSolution