I'm trying to connect my laptop to another workstation with SSH protocol.On both of my Windows PCs I installed Ubuntu to work from the terminal (WSL).I've followed tutorials found online to do the installation and the configuration but it gave me this error.
I've already checked if the ssh service is running on both of PCs and if the port 22 is listening.
$ sudo ss -tulpn | grep :22tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=227,fd=3))tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=227,fd=4))$ systemctl status sshd.service● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2023-03-09 10:19:13 CET; 3h 7min ago Docs: man:sshd(8) man:sshd_config(5) Main PID: 227 (sshd) Tasks: 1 (limit: 4031) Memory: 8.1M CGroup: /system.slice/ssh.service└─227 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"Mar 09 10:19:13 LAPTOP-69 systemd[1]: Started OpenBSD Secure Shell server.Mar 09 10:21:10 LAPTOP-69 sshd[466]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=127.0.0.1 user=helga_cassolMar 09 10:21:12 LAPTOP-69 sshd[466]: Failed password for helga_cassol from 127.0.0.1 port 52396 ssh2Mar 09 10:21:25 LAPTOP-69 sshd[466]: Failed password for helga_cassol from 127.0.0.1 port 52396 ssh2Mar 09 10:21:29 LAPTOP-69 sshd[466]: Accepted password for helga_cassol from 127.0.0.1 port 52396 ssh2Mar 09 10:21:29 LAPTOP-69 sshd[466]: pam_unix(sshd:session): session opened for user helga_cassol(uid=1000) by (uid=0)Mar 09 10:24:21 LAPTOP-69 sshd[531]: Accepted password for helga_cassol from 127.0.0.1 port 60782 ssh2Mar 09 10:24:21 LAPTOP-69 sshd[531]: pam_unix(sshd:session): session opened for user helga_cassol(uid=1000) by (uid=0)Mar 09 10:56:00 LAPTOP-69 sshd[5741]: Accepted password for helga_cassol from 127.0.0.1 port 57428 ssh2Mar 09 10:56:00 LAPTOP-69 sshd[5741]: pam_unix(sshd:session): session opened for user helga_cassol(uid=1000) by (uid=0)
Another check:
$ sudo ss -tulpnNetid State Recv-Q Send-Q Local Address:Port Peer Address:Port Processudp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=96,fd=13))udp UNCONN 0 0 127.0.0.1:323 0.0.0.0:*udp UNCONN 0 0 [::1]:323 [::]:*tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=96,fd=14))tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=227,fd=3))tcp LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=227,fd=4))
I've also already checked the firewall with sudo ufw status
and it's inactive.
With the command ifconfig
I checked the IP address for Ubuntu but if I try to ping this IP my laptop doesn't find the server.
If I use the Windows IP, I can ping the server.
So it seems that the correct IP to use is the Windows IP and not the IP created for Ubuntu.
But when I do:
ssh -vvv helga_cassol@10.x.x.xx
This is the result:
OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022debug1: Reading configuration data /etc/ssh/ssh_configdebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no filesdebug1: /etc/ssh/ssh_config line 21: Applying options for *debug2: resolve_canonicalize: hostname 10.0.0.79 is addressdebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/helga_cassol/.ssh/known_hosts'debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/helga_cassol/.ssh/known_hosts2'debug3: ssh_connect_direct: enteringdebug1: Connecting to 10.0.0.79 [10.0.0.79] port 22.debug3: set_sock_tos: set socket 3 IP_TOS 0x10debug1: connect to address 10.0.0.79 port 22: Connection refusedssh: connect to host 10.0.0.79 port 22: Connection refused
If I use the Ubuntu IP address with the same command:
ssh helga_cassol@172.xx.xxx.xx
This is the result:
connect to host 172.xx.xxx.xx port 22: Connection timed out
Do you have some ideas?Thank you in advance.