ssh - Control socket does not exist - Operation timed out - ssh

When I try to SSH on to my remote desktop from my Mac, I get this error message:
$ ssh -vvvv john#dev-dsk-john.com
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /Users/john/.ssh/config
debug1: /Users/john/.ssh/config line 26: Applying options for *
debug1: /Users/john/.ssh/config line 40: Applying options for dev-dsk*.amazon.com
debug1: /Users/john/.ssh/config line 165: Applying options for *.us-east-*.amazon.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: auto-mux: Trying existing master
debug1: Control socket "/tmp/ssh_mux_dev-dsk-john.com_22_john" does not exist
debug2: resolving "dev-dsk-john.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to dev-dsk-john.com [10.1.133.160] port 22.
debug1: connect to address 10.1.1.1 port 22: Operation timed out
ssh: connect to host dev-dsk-john.com port 22: Operation timed out
The connection hangs at
debug1: Connecting to dev-dsk-john.com [10.1.133.160] port 22.
It was working three days ago.
The system says the host is still active, so I'm pretty sure the computer is still powered on.

I faced the same problem today, and finally managed to fixed it.
I first verified that the control socket really doesn't exist. My path was "/home/ethan/.ssh/controlmasters/ethan#a.b.c.d:22" and this didn't exist.
I then ran ssh like:
ssh -M -S /home/ethan/.ssh/controlmasters/ethan#<ipaddr>:22 server.example.org
Now, it connects and also creates the control socket. Subsequently, I could open another ssh and that didn't require password and things worked normally.

Related

SSH times out when trying to connect

A few days ago i was rsyncing files to my server but it suddenly froze. Then i noticed that my SSH session also froze. When i tried sshing back it froze once again. Today my friend wanted me to ssh into his server so he made me a user gave it a password etc... (Note that he has succesfully ssh-ed in and sshd is running on port 22) but when i tried to connect it froze once again so i ran the command again with:
-vvv
The output is:
OpenSSH_9.1p1, OpenSSL 1.1.1q 5 Jul 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname <the ip address of the server> is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/anon/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/anon/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to ip [ip] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x48
debug1: connect to address ip port 22: Connection timed out
ssh: connect to host ip port 22: Connection timed out
That is the info i was able to gather but here is some general system info:
Os: arch (freshly updated)
I haven't tried much apart from updating my system since i am not an expert at SSH.

Getting connection time out while doing ssh on linux server from oracle cloud shell . It shows FIPS mode initialized and then it gets timed out again

Getting connection time out while doing ssh on linux server from oracle cloud shell . It shows FIPS mode initialized and then it gets timed out again.
kk#cloudshell:~$ ssh -i sshkey.pem opc#xx.x.x.x
FIPS mode initialized
ssh: connect to host xx.xx.x.x port 22: Connection timed out
kk#cloudshell:~ $
sshkey.pem is the private key file here to connect to linux server
Same error
user#cloudshell:.ssh (region)$ ssh -vvv opc#168.xxx.xxx.xx
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
FIPS mode initialized
debug2: resolving "168.xxx.xxx.xxx" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 168.xxx.xxx.xxx [168.xxx.xxx.xxx] port 22.
^C
Same error to Private/Public IP
user#cloudshell:.ssh (sa-saopaulo-1)$ ssh opc#192.
FIPS mode initialized

ssh: connect to host github.com port 22: on only a single project

I have been working on a particular repository for months with no problem,after a period of time i tried to make new push to remote repo and i got this
errorssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I TRIED THIS
i created a ssh key and added to my github but i still get this error, other projects on my github are working fine only this particular project has refused to accept git push
When i try ssh -Tv github.com i get this
untu-4ubuntu2.6, 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 github.com [140.82.118.4] port 22.
debug1: connect to address 140.82.118.4 port 22: Connection timed out
debug1: Connecting to github.com [140.82.118.3] port 22.
debug1: connect to address 140.82.118.3 port 22: Connection timed out
ssh: connect to host github.com port 22: Connection timed out

How to debug ssh tunnel that works and then hangs after an indeterminent time

I have two machines, m_remote and m_server. I can successfully set up an ssh tunnel from m_remote to m_server using:
ssh -f -N -T -R22222:localhost:22 m_remote_user_on_server#123.123.123.123 -i /path/to/.ssh/m_remote_key
Where 123.123.123.123 is the m_server IP address. And I can successfully use that tunnel from m_server to m_remote using:
ssh m_server_user_on_remote#localhost -p 22222 -i /path/to/.ssh/m_server_key
However after a period of time the tunnel becomes unresponsive and it's no longer possible to use it. I have to access the remote machine directly and restart the tunnel. Is there any way of debugging this? From the remote all I get is:
$ ssh -vvvv m_server_user_on_remote#localhost -p 22222 -i /home/server_user/.ssh/m_server_key
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /home/server_user/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "localhost" port 22222
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 22222.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /home/server_user/.ssh/m_server_key type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/server_user/.ssh/m_server_key-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
Then after a long pause of at least 2 minutes it logs out:
ssh_exchange_identification: Connection closed by remote host
Though this is due to a cron job I've set up to periodically kill and restart the tunnel.
** Edit **
On OSX 10.11 it's the same debug log with an additional line:
...
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: permanently_drop_suid: 501 # <-- additional line before hanging
I'm not certain as I need to diagnose and correlate this but as the m_remote machine is on a flaky home wifi connection this may be dropping and causing the tunnel to hang.
Alternatively there may be some config option such as ControlPersist (which may only be relevant to master connections) which has a low default of perhaps 10 minutes which could be increased.

Cannot ssh from Mac OS X to Linux

I have Linaro running in an embedded system (Zedboard). I am using the Mac Terminal to ssh to this system. The Zedboard has an IP. I set it in the interfaces file. This board is not connected to the internet and it is not running any firewall. I cannot ssh to this machine.
$ ssh -vvv root#169.254.218.146
OpenSSH_5.6p1, OpenSSL 0.9.8x 10 May 2012
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 169.254.218.146 [169.254.218.146] port 22.
debug1: connect to address 169.254.218.146 port 22: Connection refused
ssh: connect to host 169.254.218.146 port 22: Connection refused
Shouldn't there be a debug3 for the third verbose? Ping works however. I can ping just fine and it responds. Any help is appreciated. Thank you.
EDIT: I noticed some strange behavior. My very first connection (after booting up Linaro) actually times out.
root#Vinayak’s MacBook Pro ~ $ ssh -vvv root#169.254.218.146
OpenSSH_5.6p1, OpenSSL 0.9.8x 10 May 2012
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 169.254.218.146 [169.254.218.146] port 22.
debug1: connect to address 169.254.218.146 port 22: Operation timed out
ssh: connect to host 169.254.218.146 port 22: Operation timed out
Any SUBSEQUENT ssh's give the connection refused result.
None of the information displayed by the third debug level is relevant here. It displays additional details about the SSH connection, but no connection is being established at all here, so there's nothing to say.
Your output indicates that the Zedboard is not running an SSH server, or it is not configured to accept connections on this IP.