Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to ssh localhost #3173

Closed
ghost opened this issue May 10, 2018 · 5 comments
Closed

Failed to ssh localhost #3173

ghost opened this issue May 10, 2018 · 5 comments

Comments

@ghost
Copy link

ghost commented May 10, 2018

12

I have tried some ways from @issues2729, but still failed to ssh localhost.

xiligey@DESKTOP-9NNPCP8:~$ sudo /usr/sbin/sshd -d -p 2222
[sudo] password for xiligey:
debug1: sshd version OpenSSH_7.2, OpenSSL 1.0.2g  1 Mar 2016
debug1: private host key #0: ssh-rsa SHA256:31rf3rSuM67fNm2WneaMzIyJq4JttT2mDk7B+UvCtmA
debug1: private host key #1: ssh-dss SHA256:PJGq7XlOESo1SRfi6adWXPlketkhvcsC1vR/epk141g
debug1: private host key #2: ecdsa-sha2-nistp256 SHA256:3KSlicDZcCsHygwnsjDvkLcUPQQnrAF5S6nuFZgVshw
debug1: private host key #3: ssh-ed25519 SHA256:ZGScLJXFJImZdAnTQeRyhZDJ0JHy/DLLSNQzznxnwT8
Missing privilege separation directory: /var/run/sshd

I tried to shut down the windows internal ssh server in services.msc. But it can't help.

@ghost
Copy link
Author

ghost commented May 10, 2018

I finally fixed it with two steps!

  1. I add this into file /etc/hosts.allow:
    ssh:ALL:allow
    sshd:ALL:allow

  2. remove openssh-server, then install it again.

sudo apt-get remove openssh-client openssh-server
sudo apt-get install openssh-client openssh-server

@feinstein
Copy link

Doesn't work and now can't even reinstall SSH.

remove works, but install gives me:

sudo apt-get install openssh-client openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
openssh-sftp-server ssh-import-id
Suggested packages:
keychain libpam-ssh monkeysphere ssh-askpass molly-guard rssh
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success

@mysaggar
Copy link

I tried the same steps as specified.
I tried changing the /etc/hosts.allow file, /etc/ssh/sshd_config file for changing the port, but still, I am unable to ssh to localhost.
Below are the contents of my /etc/hosts.allow file:
image

Below are the contents of my /etc/ssh/sshd_config file

Port 2222
PermitRootLogin no
AllowUsers hduser
UsePrivilegeSeparation no
ChallengeResponseAuthentication no

UsePAM yes
X11Forwarding yes

PrintMotd no

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem       sftp    /usr/lib/openssh/sftp-server

and here is the ss of my error
image

@zenloo
Copy link

zenloo commented Aug 21, 2020

I tried everything, but it still doesn't work.Always Connection refused.

@iptoux
Copy link

iptoux commented Jun 7, 2023

Just create Directory "/var/run/sshd" or "/run/sshd" on sshd server, then it's working.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants