Ssh To Home Pc From Outside

January 05, 2018 | 1 Minute Read

In this post I will discuss how I setup ssh to home pc so that I can access it from anywhere else (office, cafe, blah, blah!!)


Step Description
Step1 Setup SSH on Desktop: Install openssh-server and start it up, so that you can ssh to it locally from another computer in the same network
Step2 PUBLIC_IP: From any computer in your home network, find out what is your public ip by goign to
Step3 Port forwarding: All traffic destined to port 22(default for ssh) should go to DESKTOP_IP:22 (an example figure given below)
Step4 SSH from anywhere to PUBLIC_IP which will take you to DESKTOP_IP or your desktop

Step 1: Setup Desktop

#install openssh-server on linux
sudo apt update
sudo apt upgrade
sudo apt install openssh-server

#Test if ssh is running by following systemctl command:
sudo systemctl status ssh

#If not running, use the following to start ssh
sudo systemctl enable ssh
sudo systemctl start ssh

Step 2: Getting Ip address from command line

dig TXT +short | awk -F'"' '{ print $2}'

Step 3: Port forwarding

Usually you can do it by going to or the admin page of your router/modem.

SSH forwarding on TP-link router (FYI: My building has wiring built in, doesnt need modem)

Step4: SSH to PUBLIC IP you got from step-2

ssh user@PUBLIC_IP