Did you know that you can navigate the posts by swiping left and right?

Exposing Campus PC On SSH

17 Jul 2019 . 2 mins : tech . Comments
#fixes #kgp #iitkgp #nginx #ssh #hack

The default port for SSH is blocked in the campus and it forces one to use a lot of workarounds to do simple SSH tasks; one such task is exposing a PC inside campus network for SSH by a PC outside the campus network.

I recently had to do the hardwork and this article shows the steps I used for the same. This will be based on Debian (and Ubuntu) users but the steps, more or less remain the same throughout.

Install OpenSSH

OpenSSH server allows creating an SSH service that allows other computers to connect to your PC via SSH. OpenSSH can be setup using the following commands:

sudo apt-get install openssh-server

Once the server is installed, follow the below instructions:

  1. Run sudo gedit /etc/ssh/sshd_config
  2. Find port 22 and change it to port 443
  3. Run sudo systemctl restart ssh
  4. Check that ssh service is now running of port 443 by the command sudo systemctl status ssh

SSH status

NOTE: The below command should install openssh client on the PC you are trying to connect from.

sudo apt-get install openssh-client

Create New User

It is highly recommended to create a new user for SSHing into your system. The same can be done on Ubuntu by the following steps:

  1. Search “Users” in the start menu and click “Users and Groups”
  2. Click Add and create a new user

User And Groups Window

We will be using “testname” as username and “testpass” as password for further purpose.

Install ngrok

We will be using ngrok to expose port 443 so that it can be connected from outside. This is required since we are behind a proxy and hence there is no public IP address for each PC but a common public IP. The below commands install and expose port.

wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
./ngrok tcp 443 --authtoken [AuthToken]

NOTE: AuthToken can be generated by signing up for a free account on ngrok. More information is present here.

Once the above command is run, you’ll see a screen like below.


tcp://0.tcp.ngrok.io:16960 is your public IP address.

SSHing From Client

Now, on the client PC do the following.

ssh [email protected]://0.tcp.ngrok.io:16960 -p 443

You’ll be prompted for the password and voila! You are into your PC inside the campus network.


I'm intrigued by human psychology and code backend for videogames. I live with a philosophy to be simple, true, and kind always. I enjoy taking days slowly and writing when I learn something new - ah! that reminds me, I enjoy learning from new experiences a lot.