SSH : connect to host 192.xx port 22: connection refused

I have 18.04 two PCs connected through LAN cable. I am able to ping PC2 from PC1. But when I try SSH to PC@ I get the following error

ssh agd@192.168.1.211
ssh: connect to host 192.168.1.211 port 22: Connection refused

PC2 has static IP configured. And when I try to SSH to PC2 through WiFi, it works.

Referring a few guides on other threads, I tried

sudo service ssh status

All good, it is running an listening to port 22

Then I tried

sudo apt-get purge openssh-server
sudo apt-get install openssh-server

That too went well. Listening to port 22 when checked the status.

Then I tried

sudo service ssh restart

All good

Then tried on both PCs

ufw allow 22

Tried and changed the port to 2222 in etc>ssh > sshd_config

It is still listening to port 22 even after a restart.

Still no luck. Most of the other guides are old. I am using 18.04. If anyone can help with is, will be thankful.

In short, I am trying to use PC2 as a storage PC or my NAS ( not exactly)

PS : I cannot see the PC2 shared folders in PC1 > Nautilus > Other locations

2 Answers

The issue was mainly the basic requirement for a LAN connection between 2 PC. PC1 too need a static IP just as PC2. I had to fix that in PC1 LAN adapter.

Once we do that, all we need to is connect the LAN cable between PCs and shared folders will be available.

You may be trying to connect to you router's IP Address instead of the server machine. Try using the ip addr which will be displaying your machine's ip address below link/ether in the second section. After that just copy and paste it and run ssh username@ServerIP like you have originally done.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like