Skip to content

Instantly share code, notes, and snippets.

@magic-lantern
Last active May 6, 2019 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magic-lantern/6720ba10e45f1af038d77871f21d466a to your computer and use it in GitHub Desktop.
Save magic-lantern/6720ba10e45f1af038d77871f21d466a to your computer and use it in GitHub Desktop.
Setting up an SSH server to proxy connections on Windows

Setting up an SSH proxy on Windows

No administrative privileges required.

Steps:

  1. Download Cygwin setup application from https://cygwin.com

  2. Run Cygwin setup file

    • Select “Install For Just Me”
    • In the Search box type “openssh” - Then expand net, and click on the openssh line twice until 7.4.x appears in the “New” column. You need OpenSSH 7.4.x as in 7.5.x the ability to run sshd as a non-administrative user was removed. Also, if you re-run the Cygwin setup, make sure you do not upgrade your OpenSSH server binaries.
    • Click Next then Next to install OpenSSH and other required Cygwin files.
  3. Once the install has completed, open a Cygwin Terminal and type:

    ssh-host-config

    Respond to Queries as follows:

    *** Query: Are you sure you want to continue?  (Say "no" if you're not sure
    *** Query: you have the required privileges) (yes/no) yes
    
    *** Query: Should StrictModes be used? (yes/no) yes
    
    *** Query: Should privilege separation be used? (yes/no) no
    
    *** Query: Do you want to install sshd as a service?
    *** Query: (Say "no" if it is already installed as a service) (yes/no) no
    

    Then run:

    vi /etc/sshd_config

    Then change the line

    #Port 22

    To the port of your choosing such as

    Port 2987

  4. Start the ssh daemon:

    /usr/sbin/sshd -D

    -D means keep sshd running in foreground so you can monitor it.

  5. Next run this command from your local machine:

    ssh username@host.domain -p XXXX -D 8080 -C -N

    -p specify port your ssh server is running on

    -D specify the local port you want to setup as a SOCKS proxy

    -C enable compression

    -N don’t need an interactive session, just start proxy

  6. Finally, configure your browser to use the SOCKS proxy for all connections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment