cygwin connection refused for port 22 - ssh

I have installed cygwin in windows 7 but i get the following error
$ ssh localhost
ssh: connect to host localhost port 22: Connection refused

I faced the same problem but I ran this on the CYGWIN command line and it worked :
~ : net start sshd
After that I executed the command ssh -v localhost and the error message didn't show up. Hope that this helps !.

If you are facing this problem in Windows XP follow these steps to open port for ssh:
Go to windows firewall of security section in control panel
Exceptions->add port
Give port name as ssh and number as 22.
Select option TCP
Click on Ok
This will help you open ssh from cygwin
For local application development like hadoop on windows please change the scope localhost /ip address in the custom list.

You can try to use port 23 or ask your host provider for the ssh port. Some host providers change the ssh port.
ssh user#yoursite.com -p 23

Cygwin doesn't install an SSH server by default, although you can set up sshd if you want. By default, however, there's nothing to ssh to.

Follow the steps in this link and then do a
$~ net start sshd
$~ ssh localhost

Related

tigervnc not connecting with localhost

stuck from a couple of days. In ubuntu i'm creating vncserver with command line [tigervnc]
vncserver -localhost yes
to secure connection from only localhost.
vnc is successfully created with port - 5901.
Im using putty to establish SSH tunnelling,
SSH tunnel
in realVNC viewer in using
localhost:9091
But it gives error saying connection refused.
I want to establish a SSH tunnel with only localhost in order to avoid the brute force attack, getting too many authentication failure errors.
What am i doing wrong. Please guide me.
Note : connection works fine if i use vncserver -localhost no. But for security reasons i dont want this
to allow connection from localhost only and to avoid brute-force attack in these any settings need to change in vnc-config or something.
Did a hell of research, couldn't resolve. StackOverflow is the last hope.
Localhost is 127.0.0.1
You have to create SSH TCP FORWARD to localhost (or 127.0.0.1), not 103.16.26.144
There is how I use this on my linux desktop, from a shell terminal.
ssh -fL 9091:localhost:5900 user#103.16.26.144 sleep 2 &&
xvncviewer localhost:9091

SSH server and localhost

I tried to install a SSH server on WSL, it never worked. So i installed my SSH server on my laptop and i try to connect, it doesn't work either. But it works from my phone on 4G or everything expect my computer on local
I get this error everytime, either with WSL Debian ou Windows :
ssh: connect to host localhost port 22: Connection refused
Check first this OpenSSH Windows installation guide:
It includes a network configuration:
Allow incoming connections to SSH server in Windows Firewall:
When installed as an optional feature, the firewall rule “OpenSSH SSH Server (sshd)” should have been created automatically.
If not, proceed to create and enable the rule as follows.
Either run the following PowerShell command as the Administrator:
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH SSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -Program "C:\System32\OpenSSH\sshd.exe"
Replace C:\System32\OpenSSH\sshd.exe with the actual path to the sshd.exe (C:\Program Files\OpenSSH\ssh.exe, had you followed the manual installation instructions above).
or go to Control Panel > System and Security > Windows Firewall1 > Advanced Settings > Inbound Rules and add a new rule for port 22.
Then you can check if at least your SSH daemon can receive anything.
The OP SRP adds in the discussion:
The problem turned out to be other machine with same IP address as the server."
I cheated and it works: I used a VPN.

SSH Connection refuse after changing port

I am connecting to CentOS7 minimal installation machine in a LAN (192.168.1.33).
I have changed the ssh port vi /etc/ssh/sshd_config line 17 Port 1234
after restarting the sshd service the connection is refused
ssh demo#192.168.1.33 -p 1234
ssh: connect to host 192.168.1.33 port 1234: Connection refused
I have disabled SELinux and router-firewall but still having problem.
Though if I change back to port 22 I can login again.
Is there any other configuration to be changed?
Can you remotely connect to the server another way? If so, once you get in, run sudo netstat -plutn.
You should see at least one entry for sshd. If you don't, sshd isn't running. You can install it via sudo apt-get install openssh-server.
If you do, is the port under 'Local Address' for the sshd line 1234? This will tell you if you successfully changed the port configuration.
Hope that helps!

SSH Connection Being Refused When I'm Remote, but not Local (Port Forwarding Already Enabled)

I set up SSH on my Ubuntu server (running XMonad) and generated a key for my laptop that I used to connect to my home server with. I also went on my wireless router and forward port 22 for SSH use. I can SSH fine when I'm at home using the standard:
ssh user#ipaddress
However when I'm outside of my local network I get this error:
ssh: connect to host xxx.xx.xx.xxx port 22: Connection refused
Everything I read says I need to either a) check that my port 22 is forward (which it is) or b) check that sshd is actually running on my Ubuntu server (which it is).
Any ideas what is preventing my SSH from working when I'm remote?
Add the following line your ssh user config file if it doesn't exits You can create the config file as shown below.
vi ~/.ssh/config
Host *
ServerAliveInterval 300
Change the permission as below:
chmod 600 ~/.ssh/config
Restart the daemon. Hope this helps.
https://serverfault.com/a/371563/617303
For me this was the cause.
In your /etc/ssh/sshd_config or /etc/ssh_ssh_config check to make sure GSSAPI Auth is disabled (set to no).
GSSAPIAuthentication no
Then restart the service or machine.

ssh connection refused from mac os x on connecting to a remote computer

I am running on Mac OS X 10.7.4.
I am unable to ssh to a remote computer, but when I do ssh user#localhost, it works fine.
The error displayed is
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to web.iiit.ac.in [14.139.82.8] port 22.
debug1: connect to address 14.139.82.8 port 22: Connection refused
ssh: connect to host web.iiit.ac.in port 22: Connection refused
I have enabled the root login in System Preferences and disabled firewall.
Also, ps aux | grep ssh shows ssh-agent, contains /usr/bin/ssh-agent -l and grep ssh in the output.
On doing sudo launchctl list|grep ssh it shows:
0 com.openssh.sshd
After this, sudo launchctl start com.openssh.sshd ; sudo launchctl list|grep ssh gives
45973 - com.openssh.sshd
Again, after checking sudo launchctl list|grep ssh after sometime, it again shows :
- 0 com.openssh.sshd
In system preferences -> sharing->enable remote login. It will fix it.
Wireless connections has well know problems with the SSH strict package receiving algorithm. I have the same problem with a WiMax connection. It would turn good if you can establish a VPN or any kind of tunnel to the server.
see also
this thread
Your remote host probably doesn't have an SSH server running (or, if it does, it's not listening on port 22).
Your tests (ps aux, launchctl etc) won't help - the issue is on the remote host, not the local (you've got an SSH client, because you can connect to localhost, but the remote host 14.139.82.8 isn't allowing connections on port 22).
When I ran in to this problem, I found that OpenSSH was not completely installed. Install it by typing into Terminal: sudo apt-get install openssh-client openssh-server
Also, check your firewall. The default SSH port is 22. Open that port.
clean known_hosts file and try again. Worked for me.