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

Unable To SSH Localhost #2729

Closed
gulshanmudgal opened this issue Dec 7, 2017 · 12 comments
Closed

Unable To SSH Localhost #2729

gulshanmudgal opened this issue Dec 7, 2017 · 12 comments

Comments

@gulshanmudgal
Copy link

  • Windows build number : Microsoft Windows [Version 10.0.16299.64]

  • hadoop@Gulshan:/home/gulshan$ ssh-keygen -t rsa -P ""
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/hadoop/.ssh/id_rsa):
    Created directory '/home/hadoop/.ssh'.
    Your identification has been saved in /home/hadoop/.ssh/id_rsa.
    Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:QxD3My4v9G48bIFla6q95HS2QM1pV/56m1kAJkCCfuU hadoop@Gulshan
    The key's randomart image is:
    +---[RSA 2048]----+
    | .+o+ |
    | . +.o |
    | . o. = o . |
    | . ..E+o* + |
    | . S+.. o |
    | o.
    +. o |
    | ===. o|
    | =.**. .=|
    | ..++o. .=.|
    +----[SHA256]-----+
    hadoop@Gulshan:/home/gulshan$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    hadoop@Gulshan:/home/gulshan$ ssh localhost
    The authenticity of host 'localhost (127.0.0.1)' can't be established.
    RSA key fingerprint is SHA256:P5ZHB0LmP1xYfo/MjGw7qbyNvLtLan+n7hKWEZhQvfk.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
    hadoop@localhost's password:
    Permission denied, please try again.
    hadoop@localhost's password:
    Permission denied, please try again.
    hadoop@localhost's password:
    Received disconnect from 127.0.0.1 port 22:14:
    Connection to localhost closed by remote host.
    Connection to localhost closed.

  • i have created ssh key for password less access, but still it's asking for password.

i would like to add that i am running ssh as Admin

capture

(https://github.com/Microsoft/BashOnWindows/blob/master/CONTRIBUTING.md) for assistance.

@therealkenc
Copy link
Collaborator

Probably the same problem as the person in #2505. Start up sshd with sudo /usr/sbin/sshd -d -p 2222 and connect with ssh localhost -p 2222 to see if that is the case.

@gulshanmudgal
Copy link
Author

getting this.
capture1

@therealkenc
Copy link
Collaborator

hadoop@Gulshan:/home/gulshan$ sudo /usr/bin/sshd -d -p 2222
[sudo] password for hadoop:
debug1: sshd version OpenSSH_7.2, OpenSSL 1.0.2g  1 Mar 2016
...blah blah blah...
Missing privilege separation directory: /var/run/sshd

I don't think your sshd even started there, because you ended back at the command prompt. Per #2505 (message), in /etc/sshd/sshd_config make sure you have:

ListenAddress 0.0.0.0
UsePrivilageSeparation no          <--- that
PasswordAuthentication yes

@SchizoDuckie
Copy link

Shut down the windows internal ssh server in services.msc.

image

Yes. That is a thing these days.
You cannot authenticate because you're connecting to the windows version of the sshd! Try eintering your windows password just for kicks.

@gulshanmudgal
Copy link
Author

Thanks to Both of You.
Finally got it working.

@ghost
Copy link

ghost commented May 10, 2018

Can you tell me how you fix it finally? Thanks! @gulshanmudgal

@ghost
Copy link

ghost commented May 10, 2018

After experiencing many failures, I finally succeeded! @gulshanmudgal

See @issue 3173

@gobbedy
Copy link

gobbedy commented Jun 20, 2018

@gulshanmudgal could you please share with others how you solved it?

@lovejavaee
Copy link

hadoop@Gulshan:/home/gulshan$ sudo /usr/bin/sshd -d -p 2222
[sudo] password for hadoop:
debug1: sshd version OpenSSH_7.2, OpenSSL 1.0.2g 1 Mar 2016
...blah blah blah...
Missing privilege separation directory: /var/run/sshd

I don't think your sshd even started there, because you ended back at the command prompt. Per #2505 (message), in /etc/sshd/sshd_config make sure you have:
ListenAddress 0.0.0.0
UsePrivilageSeparation no <--- that
PasswordAuthentication yes

UsePrivilageSeparation -> UsePrivilegeSeparation

@feinstein
Copy link

UsePrivilageSeparation is deprecated, any workarounds?

@iptoux
Copy link

iptoux commented Jun 7, 2023

UsePrivilageSeparation is deprecated, any workarounds?

Yep, just create directroy "/var/run/sshd" or "/run/sshd" on sshd server, then it's working.

@YanMiaoW
Copy link

UsePrivilageSeparation is deprecated, any workarounds?

Yep, just create directroy "/var/run/sshd" or "/run/sshd" on sshd server, then it's working.

It'work ! thanks, also remember to restart ssh service , mkdir /var/run/sshd , service ssh restart, and it's work!

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

8 participants