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@
ssh: connect to host 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


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.

  • No sir. I am using the static IP I gave to PC2. It works when using WiFi network. Since it is slow, I am trying to use LAN cable. – user227495 Feb 15 at 5:56
  • Perhaps your LAN IP is different than your Wifi's? check eth0 with ip addr – b.d98 Feb 15 at 6:13
  • I manually added this particular static IP to the wired connection in PC2. – user227495 Feb 15 at 6:15
  • Did you try an SSH connection? Has it worked? – b.d98 Feb 15 at 6:21
  • Yes, SSH Working with WiFi. – user227495 Feb 15 at 7:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.