I have used ssh
to access remote computers/servers where they provided me a username
, a password, and an IP address (like xxx:xxx:xx.xx
). What I need to do is:
ssh [email protected]
and then it will ask for the password. After entering the password, it gives me the terminal control where I can control everything from the terminal of this remote server.
I want something exactly like this but to access my own computer. I run my ubuntu pc 24/7. I want to host my pc so that from another pc/mobile terminal I can access this. How to setup my pc as a server?
I saw several answers about openssh-server
. I installed it and then did the following:
sudo systemctl enable ssh
sudo ufw allow ssh
sudo systemctl start ssh
But I cannot understand how I can access my computer. What is the IP address from my computer? I am looking for a step-by-step guide or some reference on how to enable such thing and how I can access my computer terminal remotely.
Here are my PC details:
I am using Ubuntu Desktop 20.04.6 LTS (Focal Fossa).
I downloaded the ubuntu-20.04.6-desktop-amd64.iso
from releases.ubuntu.com.
I am not sure about my IP address. When I checked it through https://whatismyipaddress.com/
, it shows that I have a Likely static IP
. However, when I connect to a different router, my IP address changed. So, probably it is dynamic.
Addition: I have followed the steps in this answer provided by Aleff below. However, since the router I am using is a public router (university dorm router), I don't have access to its configuration page. So, I cannot enable port forwarding. I am looking for a workaround in this step.
ip address
(look for the value immediately afterinet
in the output). Connect the other computer in the same network, and, run the command[email protected]
in the other computer. If they are connect to different networks, then you will have to enable port forwarding in the serversshpass -p PASSWORD ssh USER@IP_Address
Send a command:sshpass -p PASSWORD ssh USER@IP_Address "COMMAND"
The ‘USER’ and ‘PASSWORD’ are those to access the remote computer. Barry