Can't connect to server via ssh - Resource temporarily unavailable
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:
same here:
ssh -v [email protected] OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to 192.168.0.7 [192.168.0.7] port 22. debug1: connect to address 192.168.0.7 port 22: Resource temporarily unavailable ssh: connect to host 192.168.0.7 port 22: Resource temporarily unavailable
This is trying to connect to a machine on my home network.
But if i try to ssh to a linux virtual machine running on my PC, it works and it connects without any issues:
ssh -v [email protected] OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to 192.168.168.129 [192.168.168.129] port 22. debug1: Connection established. debug1: identity file /home/xxx/.ssh/id_rsa type -1 debug1: identity file /home/xxx/.ssh/id_rsa-cert type -1 debug1: identity file /home/xxx/.ssh/id_dsa type -1 debug1: identity file /home/xxx/.ssh/id_dsa-cert type -1 debug1: identity file /home/xxx/.ssh/id_ecdsa type -1 debug1: identity file /home/xxx/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/xxx/.ssh/id_ed25519 type -1 debug1: identity file /home/xxx/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 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: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr [email protected] none debug1: kex: client->server aes128-ctr [email protected] none debug1: sending SSH2_MSG_KEX_ECDH_INIT debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ECDSA 28:59:dc:aa:da:d5:af:39:7a:82:88:23:b7:11:f9:f7 debug1: Host '192.168.168.129' is known and matches the ECDSA host key. debug1: Found key in /home/dave/.ssh/known_hosts:1 debug1: ssh_ecdsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Trying private key: /home/xxx/.ssh/id_rsa debug1: Trying private key: /home/dxxxave/.ssh/id_dsa debug1: Trying private key: /home/xxx/.ssh/id_ecdsa debug1: Trying private key: /home/xxx/.ssh/id_ed25519 debug1: Next authentication method: password rootdebug1: Authentication succeeded (password). Authenticated to 192.168.168.129 ([192.168.168.129]:22). debug1: channel 0: new [client-session] debug1: Requesting [email protected] debug1: Entering interactive session. debug1: client_input_global_request: rtype [email protected] want_reply 0 debug1: Sending environment. debug1: Sending env LANG = it_IT.UTF-8 debug1: Sending env LC_CTYPE = it_IT.UTF-8 Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-62-generic x86_64)
Documentation: https://help.ubuntu.com Management: https://landscape.canonical.com Support: https://ubuntu.com/advantage Last login: Sat Jul 1 10:56:55 2017 from 192.168.168.1
I got the same issue:
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, 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 wurstbanane [192.168.1.132] port 22.
debug1: connect to address 192.168.1.132 port 22: Resource temporarily unavailable
ssh: connect to host wurstbanane port 22: Resource temporarily unavailable
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.
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.
- Does
ssh -v [email protected]work from a putty or some other remote SSH application? - If (1) works, can you try "ping 192.168.0.7" from within WSL/bash?
- If (2) works as well, can you collect a trace of the failing ssh command and share the trace file?
strace -o <trace_file> -ff ssh -v [email protected]
Does ssh -v [email protected] 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:
- Port 22 isn't visible externally because a firewall is blocking access to that port
- You've closed the last Console attached to a distro which terminates all running instances of that distro, thus shutting-down sshd
- You've logged-off the "server" which terminates all distro instances
@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 [email protected]
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
- Static ip address set to 10.0.0.2 (otherwise line 2 wouldn't work)
- Confirmed ports (22 and others) show up as
LISTENINGonnetstat -a - Router port forwarded my ports (22 and others) to the correct static address
- Windows Firewall allows ports 22 and others on Inbound Rules
sshd_configsetPortto listen to ports 22 and others.- Factory reset router and redid all the shenanigans.
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.