Skip to content

Implement Enable-SSHRemoting cmdlet #3616

Description

We need an Enable-SSHRemoting cmdlet, similar to existing Enable-PSSession cmdlet for WinRM based remoting, to set up SSH remoting on supported platforms. This would make using SSH remoting easier to use and also allow automated testing of SSH remoting.

https://github.com/PowerShell/PowerShell-RFC/blob/master/1-Draft/RFC0012-Enable-SSH-Remoting.md

Activity

  1. added this to the milestone on Apr 21, 2017
  2. RichardSiddaway commented on Apr 21, 2017

    @RichardSiddaway

    Agreed

    Configuring SSH for remoting is tsk that is better automated if at all possible

  3. modified the milestones: , on May 15, 2017
  4. modified the milestones: , on May 15, 2017
  5. 2 remaining items

  6. modified the milestones: , on Aug 22, 2017
  7. SteveL-MSFT commented on Aug 28, 2017

    @SteveL-MSFT
    Member

    I think what we may end up doing is just having a setup script in the demo folder and we can blog about it to inform users of it's existence who don't work out of GitHub

  8. PaulHigin commented on Aug 28, 2017

    @PaulHigin
    ContributorAuthor

    I am working on a set up script right now as a prototype for the Cmdlet. I don't think we should worry about Win32-OpenSSH breaking PowerShell remoting since it is intended to be closely compatible with other platform versions of SSH.

  9. SteveL-MSFT commented on Sep 21, 2017

    @SteveL-MSFT
    Member

    I think we can publish this in PowerShellGallery initially and target inclusion in the package for 6.1.0

  10. modified the milestones: 6.0.0-NiceToHave, on Sep 21, 2017
  11. soul4soul commented on Dec 6, 2019

    @soul4soul

    Two years later I'm still hoping this is implemented. I just had to write PS scripts to do this while provisioning Windows 7 and Windows 10 PCs. For windows 10 I followed several articles on docs.microsoft.com [1][2]. For Windows 7 I used chocolatey.

    For configuring the keys I followed the guide at https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement. It'd be nice to see Repair-AuthorizedKeyPermission fixed with this effort too.

  12. SteveL-MSFT commented on Dec 9, 2019

    @SteveL-MSFT
    Member

    Paul Higinbotham (@PaulHigin) has a working version, just need to publish to PSGallery. Won't be in PS7, but can be in 7.1.

  13. PaulHigin commented on Feb 5, 2020

    @PaulHigin
    ContributorAuthor

    A version 0.1.0 of PowerShell remoting tools module has been published, and which contains the Enable-SSHRemoting cmdlet.

    https://www.powershellgallery.com/packages/Microsoft.PowerShell.RemotingTools/0.1.0

    This module contains remoting tool cmdlets.

    Enable-SSHRemoting cmdlet:

    PowerShell SSH remoting was implemented in PowerShell 6.0 but requries SSH (client) and SSHD (service) components
    to be installed. In addition the sshd_config configuration file must be updated to define a PowerShell endpoint
    as a subsystem. Once this is done PowerShell remoting cmdlets can be used to establish a PowerShell remoting
    session over SSH that works across platforms.

    $session = New-PSSession -HostName LinuxComputer1 -UserName UserA -SSHTransport

    There are a number of requirements that must be satisfied for PowerShell SSH based remoting:
    a. PowerShell 6.0 or greater must be installed on the system.
    Since multiple PowerShell installations can appear on a single system, a specific installation can be selected.
    b. SSH client must be installed on the system as PowerShell uses it for outgoing connections.
    c. SSHD (ssh daemon) must be installed on the system for PowerShell to receive SSH connections.
    d. SSHD must be configured with a Subsystem that serves as the PowerShell remoting endpoint.

    The Enable-SSHRemoting cmdlet will do the following:
    a. Detect the underlying platform (Windows, Linux, macOS).
    b. Detect an installed SSH client, and emit a warning if not found.
    c. Detect an installed SSHD daemon, and emit a warning if not found.
    d. Accept a PowerShell (pwsh) path to be run as a remoting PowerShell session endpoint.
    Or try to use the currently running PowerShell.
    e. Update the SSHD configuration file to add a PowerShell subsystem endpoint entry.

    If all of the conditions are satisfied then PowerShell SSH remoting will work to and from the local system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-Enhancementthe issue is more of a feature request than a bugWG-Quality-Testissues in a test or in test infrastructureWG-RemotingPSRP issues with any transport layer

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions