SSH connection refused conencting from Unix server to Windows server - shell

I am trying to execute the below command in putty.
ssh username#servername
I am getting the below error messsage:
ssh: connect to host servername port 22: Connection refused
I am trying to connect to a Windows server from a Unix server. Please help me!

The main think is that Windows Server doesn't contain ssh daemon in the box. You could install telnet server from the Windows components and connect from unix to windows machine by telnet command or use 3d-party ssh servers/cygwin.
More available on Server Fault or SO. (How ironic, both topics are closed as offtopic)

Related

VNC viewer failing to make connection with "channel 3: open failed: connect failed: No route to host"

I ssh into a server with the following:
ssh -g -L5912:server:5912 user#host
It goes through, and I can access my files on the other server through the command line (meaning I can connect to the server, it is my vnc viewer that is failing!) but when I try to open my vnc viewer (RealVNC) and connect to localhost:12 i get the following error message in the vnc viewer application:
The connection closed unexpectedly.
Additionally in the original command line shell i get:
channel 3: open failed: connect failed: No route to host
I've tried switching to different ports and even checked out other posts on the same error message but the problem is i don't really understand them... ssh tunnels are still relatively new to me so i don't really know what im doing. Any help would be greatly appreciated. Thanks!
You're trying to setup a port forwarding, this may fail because of many reasons:
SSH port forwarding not enabled in the host
Check SSH server in the host if AllowTcpForwarding is enabled:
$ grep AllowTcpForwarding /etc/ssh/sshd_config
AllowTcpForwarding yes
Typically, it's commented out. Uncomment and restart the sshd.
No connection between the host and server over port 5912
SSH to the host and try:
$ telnet server 5912
Connected to server.
Escape character is '^]'.
Finally, does the server listen on 5912?
Similarly, as above, but from the server - go there and try telnet server 5912.
Best regards,
Jarek
In my case it was the port forwarding rule I had set in Putty.
Please make sure you enter the correct hostname when defining the rule in Putty. I changed
localhost:5903
with
myserver:5903
and it worked...

SSH connection refused from Windows 10 and ChromeOS

I have two virtual servers with Ubuntu 16.04 hosted by different providers. After I migrated my desktop from Win7 to Win10 I can not connect to the servers via SSH (see the error messages below). I have tried other operating systems as well:
Windows 10 and ChromeOS: connection refused
Windows 7, Android 8, Ubuntu 16.04 (on desktop): connection works
The same application (JuiceSSH) can connect on Android, but returns 'connection refused' on ChromeOS.
The error messages:
1. Gitbash (Windows 10)
$ ssh user#myhost
ssh: connect to host myhost port 22: Connection refused
2. Secure Shell (ChromeOS, with -vvv)
Connection with user#myhost is established...
Loading NaCl plug-in... Finished
OpenSSH_7.6p1, OpenSSL 1.0.2k 26 Jan 2017
debug2: resolving "myhost" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to myhost [myip] port 22.
debug1: connect to address myip port 22: Connection refused
ssh: connect to host myhost port 22: Connection refused
NaCl plug-in ended with the status code"255".
3. Bitwise SSH Client (Windows 10)
...
06:34:46.871 Connecting to SSH2 server slejska.de:22.
06:34:47.918 Connection failed. FlowSocketConnector: Failed to connect to target address. Windows error 10061: No connection could be established because the target computer refused the connection.
06:34:47.949 The SSH2 session has been terminated.
Remarks:
I regenerated OpenSSH host keys on the servers, but without any effect.
I deactivated the Windows Defender Firewall, but also without any effect.
Solution:
The port 22 was for some computers blocked on the router. It had nothing to do with the operating system. After opening the port for all computers, works everyting perfect. Thanks to #Nathan-McCoy
Just making my original comment more visible.
Not all systems allow TCP port 22 by default, which is the default port for ssh.
Here are some things to try and help find the source of the issue.
Suggestions
Check for open port on client
Run nmap <server> on the client which wants to connect via ssh.
If port 22 is not shown as open, this may be a firewall issue.
Check for open port on server
Run netstat on the server to see which ports are open.
If port 22 is not LISTENING then the ssh daemon is not setup properly.

Bash Ubuntu on Windows 10, connect to host port 22: Connection Failure

I just installed the Bash Ubuntu on Windows 10 natively. When I try and acess a remote server I get ssh: connect to host HOSTNAME port 22: Connection refused
I have tried to find a solutions, but the solutions doesn't work.
This is what I have tried:
https://askubuntu.com/questions/59458/error-message-sudo-unable-to-resolve-host-user/733120#733120
When I could not acess /etx/hosts I tried this:
https://askubuntu.com/questions/326239/cannot-access-etc-hosts
After downloading gksudo to try and edit /etc/hosts I got this error message (gksudo:2601): Gtk-WARNING **: cannot open display:
Are u sure everything is correctly setup?
I just tried
ssh -T git#github.com
in my Bash on Ubuntu on Windows.
and it totally works Returning
Hi <usernamer>! You've successfully authenticated, but GitHub does not provide shell access.
Maybe you have some settings that prevent connections? for example in ~/.bashrc?
Maybe your server needs a different port? use ssh -p 2222 for that.

knife winrm to windows machine fails with Connection Refused

I am trying to use knife to bootstrap a windows machine.
When running the command 'knife bootstrap windows winrm' i receive the following error:
ERROR: Network Error: Connection refused - connect(2) (http://<server>:5985)
What might be the problem?
Open firewall port 5985 on your windows node. This port is used by WS-management. Click here to find out how to enable this port

Connecting to Windows SSH Server

I am a newbie trying out SSH. The scenario is I have 2 machines - Windows 7 PC(Desktop) and a VMWare machine (Windows 7). Cygwin installed on both. I am trying to connect the VMWare machine to the desktop. I have installed the OpenSSH server on Desktop server. I verified it is running, using netstat.
I modified the Windows firewall, by adding to the Inbound Rules to allow connections for port 22.
My problem is I am unable to connect from the VMWare machine.
$ ssh -v user_name#my_machine
OpenSSH_5.5p1, OpenSSL 0.9.8q 2 Dec 2010
debug1: Connecting to my_machine port 22.
debug1: connect to address my_machine port 22: Connection refused
ssh: connect to host my_machine port 22: Connection refused
What am I doing wrong? What are my options to configure? Any links or answers would be helpful.
Thank you.
WM
Open your command prompt and run the following command:
ssh -v Your_User_Name#Your_IP_Address
If response is:
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Connecting to Your_IP_Address port 22.
debug1: connect to address Your_IP_Address port 22: Connection refused
ssh: connect to host Your_IP_Address port 22: Connection refused
Then go to the Windows Service called OpenSSH SSH Server is started and running, it is set to manual start as default so it will not be running unless you have started it.
Now run above command again. SSH command will connect to the user.
You should make sure that my_machine allows inbound connection. Check the firewall....
(if you can run this command locally - but not from the other machine it might be that case).
If the ssh server on the Desktop is accessible in the localhost then try this
Desktop <- Desktop Firewall <- VM Firewall <- VM
Try shutting down the firewalls in between one by one to check where the issue starts after then configure accordingly. Remember that the Desktop Firewall rules should be inbound and the VM Firewall is outbound

Resources