Closed WurstCommander closed 6 years ago
Might help if you add your windows version and what firewall / antivirus you use (if any)
Windows 10 Pro Version 1703 Built 15063.447
Windows Defender and Windows Firewall, nothing else.
@WurstCommander - Thanks for your post. If you can try couple of things and in the order and share your results, that would be great.
ssh -v root@192.168.0.7
work from a putty or some other remote SSH application?strace -o <trace_file> -ff ssh -v root@192.168.0.7
Does ssh -v root@192.168.0.7 work from a putty or some other remote SSH application?
yeah it does (IP changed of the server)
ssh -v root@wurstbanane
OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
debug1: Connecting to wurstbanane [192.168.1.190] port 22.
debug1: Connection established.
....
I sadly just deinstalled bash for windows because it didn't work, maybe I'll get me motivated again :-)
I see the same problem on two different WSL installations - both Windows 10 with all updates and the latest available WSL installed for this Windows version:
Windows 10 Enterprise, Version 1703, OS Build 15063.483
Within bash, "uname -a" yields (replacing the node name here with "localnode") Linux localnode 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux
Also within bash, "lsb_release -a" yields No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.2 LTS Release: 16.04 Codename: xenial
I ran the strace command you requested. Output, edited to replace account and machine name details, is in the file attached. Hope this gives you enough to work on. strace-ssh.temp.txt
The same story here. The problem started after I configured my Hassbian for a static IP. Nothing else changed, just rebooted my RPi - worked fine before reboot/reconfiguration, "Resource temporarily unavailable" after.
@alansill thx for doing "my work". I just hadn't the time to reinstall bash for windows.
Adding a windows firewall rule worked for me. Basically you need to tell the firewall to allow the port you use for ssh. Configurations you need to do are similar to this.
@sxhexe Thanks for the insight. Worked for me as well. I added an outbound rule for port 22.
I was having the same problem Win 10 Pro insider preview build 16281. I had SSH working fine for logging into our Esxi Shell, and out of no where it was giving the same error, but like @alenmeister I added rule to firewall for port 22 and that cured my issue. Thanks for the feed back.
All: If you're trying to ssh into an sshd "server" running in WSL, you'll likely hit the "port 22: Resource temporarily unavailable" error if:
@WurstCommander - your first example, where you see this error when trying to access a machine on your network is most likely caused by the firewall on that machine blocking access to port 22. Your second example, of being able to connect to ssdh running on a Linux VM on your local machine is because that Linux instance isn't running a firewall, or the installed firewall exposes port 22 to the public network.
You can list the ports open on your WSL "server" by running netstat -a
from PowerShell/Cmd and looking for open port 22
I'll write up some instructions and additional info on this scenario on our blog (https://blogs.msdn.microsoft.com/commandline) as it seems to be causing problems.
I had the same problem (logging onto a VM running ubuntu) because I had prematurely added an entry in $HOME/.ssh/config allowing IdentitiesOnly as login on my local machine. However, the pub key had not been added to .ssh/authorized_keys, yet.
So, setting IdentitiesOnly to false, then using ssh-copy-id and finally login worked.
use telnet
seems there is no firewall problem
Diluka@Diluka-Z7:~/.ssh$ telnet 192.168.250.189 22
Trying 192.168.250.189...
Connected to 192.168.250.189.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
but ssh can't establish connection
Diluka@Diluka-Z7:~/.ssh$ ssh -v diluka@192.168.250.189
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.250.189 [192.168.250.189] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/Diluka/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Diluka/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Diluka/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Diluka/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Diluka/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Diluka/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Diluka/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Diluka/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.250.189:22 as 'diluka'
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 192.168.250.189 port 22
@Diluka Note that Linux binaries run atop WSL alongside Win32 process, and that both run ABOVE the firewall. This for traffic between Win32 and Linux processes on the same machine do not reach the Windows firewall & should be able to communicate relatively unhindered.
If you're trying to ssh into a "remote" ssh server, you will need to ensure that the firewall in front of your ssh server has exposed the ssh server's port (22 in your example above) to the external network.
Also, if you want to use shared key authentication, you'll need to register your client's SSH public key with your ssh server.
solved it by reinstall openssh-server
@Diluka Thanks for letting us know.
@WurstCommander Could you please close this issue if your problem is resolved?
Version: windows 10 home build 16299. Had same problem.
I solved it, either because I had accidentally ssh'd with sudo or because reinstalled openssh-server (changed both, can't establish clear causation)
Thanks @naefl.
Hey @WurstCommander - can you confirm if this issue is now resolved, and close this issue if it is?
UPDATE - SOLVED:
Xfinity's provided rented modem/router was the issue. Highly recommend you to end that plan and get your own especially if you want a home server.
While I am able to get localhost to work on ports 22 (and others), unfortunately, it doesn't work on when trying to connect through public IP.
$ ssh [user]@localhost -p [port] # works
$ ssh [user]@10.0.0.2 -p [port] # works
$ ssh [user]@[public_ip] -p [port]
ssh: connect to host [public_ip] port [port]: Resource temporarily unavailable
LISTENING
on netstat -a
sshd_config
set Port
to listen to ports 22 and others.I've gotten this to worked perfectly and was able to use my computer as a WAN-accessible server. However I've deleted WSL and redid everything now it doesn't work. Maybe things change in later Windows build?
Windows Build: 17115
Sorry if I'm posting this in the wrong place, very similar issue so I didn't want to make another one. Lmk if I should.
@ketozhang - Not sure I fully understand your setup. Are you trying to SSH into WSL or SSH'ing from WSL or both? If you can isolate this issue to WSL that would be helpful too i.e replace any WSL instance with a native Linux and see if it changes anything.
@sunilmut No worries it's solved. The issue is parallel to the original issue; I was unable to SSH into a WSL server using public ip instead of local ip.
This is likely a ISP or setup problem not a WSL bug and it is the ISP's rental equipments.
Reinstalling sshd (openssh-server) fixed this for me. No firewall changes required:
apt-get remove openssh-server (reboot WSL) apt-get install openssh-server systemctl enable ssh.service systemctl restart ssh.service
From the local Windows 10 Cygwin prompt: ssh linuxruser@127.0.0.1
Windows Firewall > Advanced Settings
top
. On the right side there should be a process listed as sshd
. If there is none: service ssh start
My issue was that the domain had been moved to cloud front and I needed to use the direct IP address instead of the domain name.
I received a "Resource temporarily unavailable" error because my subnet did not have a route to an Internet Gateway
I'm so stupid. I just had this problem because I installed Nginx in the server and it blocks SSH by default. You have to sudo ufw allow ssh
I like that this is still a problem.
thisisfine.gif
@AleksandrHovhannisyan - sorry - what problem? ssh should work fine.
ssh
always gives me a port 22 timeout/error on both WSL and PowerShell.
Maybe it's not a Windows thing? Idk. The only time I've been able to ssh into another machine is when that machine was a virtual machine in VirtualBox.
@AleksandrHovhannisyan @bitcrazed Every time I update windows I have a problem with SSH to my ec2 instance. I tried most of the solutions in this issue and it still does not work. The solution that seemed to work for me the longest time was to add 8.8.8.8 as a NameServer in the /etc/resolv.conf file in WSL and this configuration had to be done everytime wsl is booted. This does not work for me since the latest update.
Also its worth noting that I am connecting to my server through a VPN (which is a requisite).
Hey Arjun: It's very difficult to provide assistance with zero details about your environment, what you're seeing, repro steps, etc.
Also, please don't comment on closed threads - there are several other open VPN & SSH threads that're likely to get more attention. If none of these describe your scenario, please file a new issue with as much info as you can. Thanks.
/cc @craigloewen-msft
do this: sudo ufw allow ssh
or if you wanna be specific on ssh port(22) do sudo ufw allow 22
.
To check if firewall added properly: sudo ufw status
.
This thing actually happens when you do sudo ufw enable
and forget to add a ssh or port 22
firewall.
Hi all, Maybe someone helps me to fix this issue: I tried to connect via ssh in Ubuntu(WSL) but I got the following error:
OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f 31 Mar 2020 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/.conf matched no files debug1: /etc/ssh/ssh_config line 21: Applying options for debug1: Connecting to 10.1.1.9 [10.1.1.9] port 22. debug1: connect to address 10.1.1.9 port 22: Resource temporarily unavailable ssh: connect to host 10.1.1.9 port 22: Resource temporarily unavailable
Then I tried to disable ufw or open it for port 22 : but I got the following error: sudo ufw allow 22/tcp WARN: initcaps [Errno 2] iptables v1.8.4 (legacy): can't initialize iptables table `filter': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.
and
sudo ufw status [sudo] password for sara: ERROR: problem running iptables: iptables v1.8.4 (legacy): can't initialize iptables table `filter': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.
I have upgraded the kernel fully but I got same error again: sudo iptables -L iptables v1.8.4 (legacy): can't initialize iptables table `filter': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.
** we use an open VPN credential to connect and my system ssh public key has been set on the server.
many thanks, Sara.
I faced the same problem suddenly after ssh was working fine, then I found that windows made an update which affected my Hyper-V virtual switch configuration .. somehow after some trails I was able to fix it mainly by disabling and removing one of the Hyper-V virtual switches added after the windows update
This is still a problem. I cannot ssh to my Ubuntu 22.04 machine running on Hyper-V (Windows 11, both host and guest have the latest updates.)
tolga@host:$ scp datafile.csv tolga@192.168.0.41:/home/tolga/Desktop
ssh: connect to host 192.168.0.41 port 22: Resource temporarily unavailable
tolga@host:$ ssh tolga@192.168.0.41 -vvv
OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.0.41 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.0.41 [192.168.0.41] port 22.
debug1: connect to address 192.168.0.41 port 22: Resource temporarily unavailable
ssh: connect to host 192.168.0.41 port 22: Resource temporarily unavailable
Checks so far:
Edit: corrected command view, added verbose output.
This a reopening / copy from "Can't connect to server via ssh #809" - https://github.com/Microsoft/BashOnWindows/issues/809#issuecomment-312420698
If you watch the last comments you can see that the problem isn't fixed:
I got the same issue:
There are multiple people in the old issue posting the same problem. I tried git bash, cgywin, bitverise and Filezilla which all connect without a problem. I tried reinstalling BashOnWindows, nothing works.
If you need some logs etc. I could provide them and help.
Thank you.