When I'm trying to ssh to my local ubuntu server from the gitbash on my windows machine Im getting this error:
$ ssh 192.168.1.11 ssh: connect to host 192.168.1.11 port 22: Bad file number Other answers I've found seems to be related to linux-to-linux connetions. I'm newbie here, can you please provide information how to achieve that?
Running nmap -sS 192.168.1.11 -p 22:
C:\Users\Me>nmap -sS 192.168.1.11 -p 22 Starting Nmap 6.40 ( ) Nmap scan report for 192.168.1.11 Host is up (0.0040s latency). PORT STATE SERVICE 22/tcp filtered ssh MAC Address: 20:16:D8:3E:E0:30 (Liteon Technology) Nmap done: 1 IP address (1 host up) scanned in 13.70 seconds Running: ssh -v 192.168.1.11 -p 443:
$ ssh -v 192.168.1.11 -p 443 OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 debug1: Reading configuration data /c/Users/Me/.ssh/config debug1: Applying options for 192.168.1.11 debug1: Connecting to 192.168.1.11 [192.168.1.11] port 443. debug1: connect to address 192.168.1.11 port 443: Attempt to connect timed out w ithout establishing a connection ssh: connect to host 192.168.1.11 port 443: Bad file number And even if I edit my .ssh/config like this:
Host ubuntu.dev Hostname 192.168.1.11 User meubuntu And connecting to ssh ubuntu.dev It still does not work
2 Answers
I know this is an old question, but it came up sorta high up in the Google search, so, for anyone having troubles for SSH'ing from a Windows to a Linux box, in my case, the problem was that I hadn't installed the SSH server on my Linux Mint machine.
Even if you do have SSH installed (like for connecting to another computers), you need this package to enable receiving connections.
sudo apt-get install openssh-server 1From your nmap output
PORT STATE SERVICE 22/tcp filtered ssh You can see the State of port 22 is set as filtered meaning its being blocked either by your ISP or by some firewall. We can use port 443 for doing ssh which wont be blocked by ISP or firewall as folllows.
ssh -v 192.168.1.11 -p 443 This will connect to ssh using port 443.
For more ways to do this see this question.
1