Repository navigation
Implement Enable-SSHRemoting cmdlet #3616
Description
Activity
- addedWG-RemotingPSRP issues with any transport layerPSRP issues with any transport layerWG-Quality-Testissues in a test or in test infrastructureissues in a test or in test infrastructureIssue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bug
on Apr 21, 2017 - added this to the This milestone has been deleted milestone
on Apr 21, 2017 Agreed
Configuring SSH for remoting is tsk that is better automated if at all possible
- modified the milestones: This milestone has been deleted, This milestone has been deleted
on May 15, 2017 - modified the milestones: This milestone has been deleted, This milestone has been deleted
on May 15, 2017 2 remaining items
- modified the milestones: This milestone has been deleted, This milestone has been deleted
on Aug 22, 2017 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
PaulHigin commented
on Aug 28, 2017 ContributorAuthorMore actionsI 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.
I think we can publish this in PowerShellGallery initially and target inclusion in the package for 6.1.0
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-AuthorizedKeyPermissionfixed with this effort too.Paul Higinbotham (@PaulHigin) has a working version, just need to publish to PSGallery. Won't be in PS7, but can be in 7.1.
Reacted by soul4soul and lukeb1961PaulHigin commented
on Feb 5, 2020 ContributorAuthorMore actionsA 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.
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