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

Failure installing OpenSSH native #3340

Closed
angelog0 opened this issue Jun 30, 2018 · 9 comments
Closed

Failure installing OpenSSH native #3340

angelog0 opened this issue Jun 30, 2018 · 9 comments

Comments

@angelog0
Copy link

angelog0 commented Jun 30, 2018

Just trying @DarthSpock suggestion in #3325, I tried to install the OpenSSH server native following one of the tutorials found on the WEB. For example this tutorial1 which also contains this reference tutorial2. Both refer to the beta version of OpenSSH sever but now (in April update) we know it is out of beta.

The problems arise when I try (for example, from tutorial2) to start ssh-agent and/or generate ssh-keygen.

Is there a tutorial for installation and usage of this OpenSSH server not in beta? If not, then you/someone should write it.

This is the output from PS as administrator:

Windows PowerShell
Copyright (C) Microsoft Corporation. Tutti i diritti sono riservati.

PS C:\WINDOWS\system32> Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'


Name  : OpenSSH.Client~~~~0.0.1.0
State : Installed

Name  : OpenSSH.Server~~~~0.0.1.0
State : Installed



PS C:\WINDOWS\system32> Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0


Path          :
Online        : True
RestartNeeded : False



PS C:\WINDOWS\system32> cd C:\Windows\System32\OpenSSH
PS C:\Windows\System32\OpenSSH> Start-Service ssh-agent
Start-Service : Impossibile avviare il servizio 'OpenSSH Authentication Agent (ssh-agent)' a causa del seguente
errore: Impossibile avviare il servizio ssh-agent sul computer '.'.
In riga:1 car:1
+ Start-Service ssh-agent
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
   ServiceCommandException
    + FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceCommand

PS C:\Windows\System32\OpenSSH> .\ssh-keygen -A
C:\Windows\System32\OpenSSH\ssh-keygen.exe: generating new host keys: RSA Could not save your public key in __PROGRAMDATA__\\ssh/ssh_host_rsa_key.HXbwLr0RNp: No such file or directory
C:\Windows\System32\OpenSSH\ssh-keygen.exe: generating new host keys: DSA Could not save your public key in __PROGRAMDATA__\\ssh/ssh_host_dsa_key.q6HrKziqxp: No such file or directory
C:\Windows\System32\OpenSSH\ssh-keygen.exe: generating new host keys: ECDSA Could not save your public key in __PROGRAMDATA__\\ssh/ssh_host_ecdsa_key.nF7St2spR9: No such file or directory
C:\Windows\System32\OpenSSH\ssh-keygen.exe: generating new host keys: ED25519 Could not save your public key in __PROGRAMDATA__\\ssh/ssh_host_ed25519_key.x6irJqIWEH: No such file or directory
PS C:\Windows\System32\OpenSSH> dir


    Directory: C:\Windows\System32\OpenSSH


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       10/03/2018     19:20         343552 scp.exe
-a----       01/05/2018     01:16         355840 sftp-server.exe
-a----       10/03/2018     19:20         408064 sftp.exe
-a----       10/03/2018     19:20         531968 ssh-add.exe
-a----       10/03/2018     19:20         495616 ssh-agent.exe
-a----       10/03/2018     19:20         657920 ssh-keygen.exe
-a----       10/03/2018     19:20         594944 ssh-keyscan.exe
-a----       01/05/2018     01:16         154624 ssh-shellhost.exe
-a----       10/03/2018     19:20         894464 ssh.exe
-a----       20/05/2018     10:26         970240 sshd.exe
-a----       01/05/2018     01:16           2143 sshd_config_default


PS C:\Windows\System32\OpenSSH>
@therealkenc
Copy link
Collaborator

therealkenc commented Jun 30, 2018

You want Powershell/OpenSSH for questions about native OpenSSH on Windows. For sshd on WSL you want sudo apt install openssh-server + sudo sevice ssh start.

@angelog0
Copy link
Author

angelog0 commented Jun 30, 2018

@therealkenc wrote:

For sshd on WSL you want sudo apt install openssh-server + sudo sevice ssh start.

As I wrote, this does not work if I want to connect from WSL on a Windows machine to WSL on another different Windows machine... It works only as localhost on the same machine.

@therealkenc
Copy link
Collaborator

It works only as localhost on the same machine.

No, you can connect to sshd in WSL from remote hosts. People have been doing that since 2016.

@angelog0
Copy link
Author

@therealkenc wrote:

No, you can connect to sshd in WSL from remote hosts. People have been doing that since 2016.

On WSL (Ubuntu 16.04) in Win10 Pro 64:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

$ sudo apt purge openssh-server
[...]
Rimozione di openssh-server (1:7.2p2-4ubuntu2.4)...
invoke-rc.d: could not determine current runlevel
 * Stopping OpenBSD Secure Shell server sshd                                                             [ OK ]
Eliminazione dei file di configurazione di openssh-server (1:7.2p2-4ubuntu2.4)...
Elaborazione dei trigger per man-db (2.7.5-1)...

$ sudo apt install openssh-server
[...]
256 SHA256:l/k7SsZbN5ZoO9U4s9X9Fym917QRUoV/H89iANJ1hqA root@Tatooine (ED25519)
invoke-rc.d: could not determine current runlevel
Elaborazione dei trigger per systemd (229-4ubuntu21.2)...
Elaborazione dei trigger per ureadahead (0.100.0-19)...
Elaborazione dei trigger per ufw (0.35-0ubuntu2)...

$ sudo service ssh start
 * Starting OpenBSD Secure Shell server sshd                                                             [ OK ]

$ ps -A | grep sshd
  915 ?        00:00:00 sshd

Now from WSL (Ubuntu 16.04) Windows Home 64 on another machine (WiFi connected) in the LAN:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

$ ssh WSL_WIN10PRO-USER@WIN10PRO-IP
ssh: connect to host WIN10PRO-IP port 22: Resource temporarily unavailable

$ ssh -p 2222 WSL_WIN10PRO-USER@WIN10PRO-IP
ssh: connect to host WIN10PRO-IP port 2222: Resource temporarily unavailable

Notice that I have a different name for the WSL_WIN10PRO-USER, i.e.

WSL_WIN10PRO-USER != WIN10PRO-USER

Also adopting your #2505 suggestions regarding /etc/sshd/sshd_config produces the same results. Only this seems to work in another WSL-terminal on Win10Pro (the same on which sshd is running):

ssh localhost -p 2222

Please, give us a detailed recipe to have success in connecting WSL and WSL between remote machines...

@onomatopellan
Copy link

Resource temporarily unavailable

That sounds like #2278

@therealkenc
Copy link
Collaborator

therealkenc commented Jun 30, 2018

It sounds like you've got incoming port 22 blocked. Your problem isn't related to the username or a port 22 conflict because you haven't made it that far yet. Try turning off Windows firewall. After you get it running initially you can fine tune just exposing port 22 or port 2222.

@angelog0
Copy link
Author

@therealkenc I will do nothing because all this is a proof that both on WSL and natively this kind of things do not work OB and request a lot of work to the user. As I wrote here and there, the Windows Pro machine is in dual boot with GNU/Linux and there I did nothing but I can connect to it from the machine with Windows Home and from another machine with macOS, and I can connect to macOS from the Windows Pro machine. All this via port 22. It seems that there is not a clear and simple solution.

@therealkenc
Copy link
Collaborator

I will do nothing because all this is a proof that both on WSL and natively this kind of things do not work

To be clear, they do. Thank you for closing the issue.

@angelog0
Copy link
Author

angelog0 commented Jul 1, 2018

@therealkenc you continue to affirm that it works without giving a simple recipe which proofs that. Please, give us, step-by-step, the recipe and than we will see if it works. All references you give proof that people which has solved the issue has adopted different strategies, someone simply reinstalling the ssh server, others working with the firewall, others using a different remote SSH... So, which solution?

If you insist in saying it works then you should also say "do this.. this... and this and it will works" otherwise you have only workarounds.

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

3 participants