Created
September 27, 2024 10:39
-
-
Save mcx808/b375be86c8df1a4196cb0e7f37f4ef4e to your computer and use it in GitHub Desktop.
Enable Powershell Subsystem for SSH on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$subsystemConfig = @" | |
Subsystem powershell /usr/bin/pwsh -sshs -nologo`n | |
"@ | |
$existingContent = Get-Content -Path /etc/ssh/sshd_config -Raw | |
$lastSubsystemIndex = $existingContent.LastIndexOf("Subsystem") | |
$newContent = $existingContent.Insert($lastSubsystemIndex, $subsystemConfig) | |
Set-Content /etc/ssh/sshd_config -Value $newContent | |
systemctl restart sshd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment