Error OpenSSH over TAILS - linux

everyone Im first time poster, wanna know what wrong I'm doing :) help me please. So, Im using tails, decided to connect to remote server (digitalocean) using OpenSSH. Generated public and private Keys, placed to /root/.ssh/. But when I'm trying to connect ssh -v root#11.11.11.11 Here is what I get after debug.
root#amnesia:/home/amnesia# ssh root#11.11.11.11
FATAL: Failed to determine SOCKS server.
ssh_exchange_identification: Connection closed by remote host
root#amnesia:/home/amnesia# ssh -v root#11.11.11.11
OpenSSH_6.7p1 Debian-5+deb8u1, OpenSSL 1.0.1k 8 Jan 2015
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 4: Applying options for *
debug1: Executing proxy command: exec /usr/local/lib/connect-socks 11.11.11.11 22
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: permanently_drop_suid: 0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u1
FATAL: Failed to determine SOCKS server.
ssh_exchange_identification: Connection closed by remote host
Maybe I just forgot to add some simple step, which bothers me already 3 days..^^ :D

I think the issue is here;
FATAL: Failed to determine SOCKS server.
ssh_exchange_identification: Connection closed by remote host
It appears as if there is no server listening on the IP address 11.11.11.11.
Is this a domain address known by you to have a ssh server listening on it? If the answer is yes, my recommendation is to not use the root user as someone who can log in via ssh since this is a security risk. I believe it is not allowed per default in OpenSSH.

Same problem using the root terminal, have you tried with the regular terminal from the favorite menu?

Related

SSH error kex_exchange_identification ignoring ConnectionAttempts?

I have a CI/CD that builds a program.
This program has several dependencies that are hosted on a private GitLab.
These dependencies are downloaded through GIT using SSH.
This private GitLab is very unstable and has a firewall that refuses several connections and many times my CI/CD doesn't work because the server refuses the connection.
I did some research and noticed that SSH has a setting called ConnectionAttempts, which would be the number of connection attempts, but when I get the kex_exchange_identification error SSH doesn't try to connect again.
Does the kex_exchange_identification error pause SSH execution on time and ignore ConnectionAttempts? Is there any way to program retries for this?
Full error:
OpenSSH_8.4p1 Debian-5+deb11u1, OpenSSL 1.1.1n 15 Mar 2022
debug1: Reading configuration data /root/.ssh/config
debug1: /root/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/root/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/root/.ssh/known_hosts2'
debug2: resolving "gitlab.luizalabs.com" port 22
debug2: ssh_connect_direct
debug1: Connecting to gitlab.luizalabs.com [x5.xx7.2xx.xx] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug3: timeout: 299884 ms remain after connect
debug1: identity file /root/.ssh/id_rsa type 0
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa_sk type -1
debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_ed25519_sk type -1
debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u1
kex_exchange_identification: Connection closed by remote host
Connection closed by x5.xx7.2xx.xx port 22
fatal: Could not read from remote repository.

ssh_exchange_identification: connection closed by remote host linux server to Mac machine

I am trying to SSH from my linux server to Mac server. I did copied the Linux server pub key to Mac server authorized_keys file. We are using proxy in my linux server. It was throwing the error "ssh_exchange_identification: Connection closed by remote host". Please let me knowhow to check if Proxy is stopping SSH to remote server. I did ssh -v administrator#207.52.167.245 and below are the details.
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 62: Applying options for *
debug1: Executing proxy command: exec /usr/bin/sss_ssh_knownhostsproxy -p 22 207.52.167.245
debug1: permanently_drop_suid: 1990977432
debug1: identity file /home/us-svclhjenkins/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/us-svclhjenkins/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/us-svclhjenkins/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/us-svclhjenkins/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/us-svclhjenkins/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/us-svclhjenkins/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/us-svclhjenkins/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/us-svclhjenkins/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
ssh_exchange_identification: Connection closed by remote host

Unable to do SSH to remote Server. Error : ssh_exchange_identification: read: Connection reset by peer

I have changed the file sshd_config under /etc/ssh/ directory. I have also changed the permission of files under /etc/ssh/ directory. Now when i am trying to execute
ssh username#remoteserverIP -vv
I am getting below logs.
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 *
debug2: resolving "server IP" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to server IP [server IP] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
ssh_exchange_identification: read: Connection reset by peer
I do not have access to root user. I have also tried via putty. Putty is giving below error.
Server unexpectedly closed network connection
Perhaps /etc/hosts.deny contains an entry for "ALL:" or "ssh:" preventing you to connect.
Adding "ssh: ALL" or "ssh: x.x.x.x" (replacing x.x.x.x with your IP) to /etc/hosts.allow could resolve this issue.

SSH freezes after reboot

I am using Raspberry Pi 3 with Raspbian Stretch Lite installed on it. Sometimes when I reboot my rpi, I cannot login through ssh afterwards. There are 4 possible scenarios after reboot:
Connection refused error all the time.
PuTTy hangs after entering password, just no error is produced.
I can log, but entering any command in PuTTy results in no response.
When connectin with PuTTy just black screen, even no password prompt.
My /etc/ssh/sshd_config file has only these lines uncommented:
PermitRootLogin yes
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
EDIT: output of ssh -v
ssh -v root#10.24.1.52
OpenSSH_7.4p1 Raspbian-10+deb9u1, OpenSSL 1.0.2l 25 May 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.24.1.52 [10.24.1.52] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Raspbian-10+deb9u1
There are few things you can do to debug the problem.
Use verbose mode on the client side (ssh -v / ssh -vv / ssh -vvv); you seem to have exercised that option already
Inspect logs on server side (Raspberry Pi), cat /var/log/auth
Inspect network connection between client (PC that runs PuTTy) and server (Raspberry Pi). Is it wired/wireless? Is there any extra network equipment in between, like router/firewall?

Can SSH via putty but fail via terminal

I've been trying to access my raspberry server using ssh. In Windows 7 I'm using cygwin. Here the command I used.
ssh pi#10.34.8.56 -v
And here the result
OpenSSH_7.3p1, OpenSSL 1.0.2h 3 May 2016
debug1: Connecting to 10.34.8.56 [10.34.8.56] port 22.
debug1: Connection established.
debug1: identity file /home/Maswari/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/Maswari/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Raspbian-5+deb8u3
debug1: match: OpenSSH_6.7p1 Raspbian-5+deb8u3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 10.34.8.56:22 as 'pi'
debug1: SSH2_MSG_KEXINIT sent
Connection reset by 10.34.8.56 port 22
I also try to ssh via Ubuntu inside vagrant using this command
ssh pi#10.34.8.56 -v
And the result was
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 10.34.8.56 [10.34.8.56] port 22.
debug1: Connection established.
debug1: identity file /home/vagrant/.ssh/id_rsa type 1
debug1: identity file /home/vagrant/.ssh/id_rsa-cert type -1
debug1: identity file /home/vagrant/.ssh/id_dsa type -1
debug1: identity file /home/vagrant/.ssh/id_dsa-cert type -1
debug1: identity file /home/vagrant/.ssh/id_ecdsa type -1
debug1: identity file /home/vagrant/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/vagrant/.ssh/id_ed25519 type -1
debug1: identity file /home/vagrant/.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_6.7p1 Raspbian-5+deb8u3
debug1: match: OpenSSH_6.7p1 Raspbian-5+deb8u3 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 10.34.8.56
But somehow, when I try to connect using PuTTY, everything is fine. I can access my server. I look up ssh log and give me particular result
sshd[6553]: fatal: Read from socket failed: Connection reset by peer [preauth]
sshd[6823]: fatal: Read from socket failed: Connection reset by peer [preauth]
sshd[6934]: Accepted password for pi from 172.19.0.5 port 51395 ssh2
sshd[6934]: pam_unix(sshd:session): session opened for user pi by (uid=0)
SSH from Cygwin and terminal seems produce this error
sshd[6553]: fatal: Read from socket failed: Connection reset by peer [preauth]
I've already reinstall ssh in the server, regenerate the keys, but still give the same result. Does anyone know how to solve this. So I can access my server through terminal or PuTTY.
sshd[6553]: fatal: Read from socket failed: Connection reset by peer
[preauth]
This means that there is a ssh-key generated and only the person with that key can access it. To fix this do...
sudo apt-get purge openssh-server
then
sudo apt-get autoremove
last
sudo apt-get install openssh-server
then try
ssh -i deployment_key.txt demo#192.237.248.66

Resources