Powershell: New-PSSession and SSH pass a password?

Created on 16 Feb 2019  路  8Comments  路  Source: PowerShell/PowerShell

Im trying from Windows connecting to Linux thru SSH and there is a -Username parameter but I dont see a -Password parameter; This means that each time I connect, it asks for me a password.

Get-Credentials do not seem to work with -Hostname

Issue-Question Resolution-Answered

All 8 comments

Please read https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core?view=powershell-6 and consider ssh-agent.

I dont see anything about ssh-agent in the link you provided (searched)

And I also dont see anything about passing a password (searched for password as well)

This means that each time I connect, it asks for me a password.
--- yes锛寉ou can never save password use Clear text or cipher text on powershell ssh remoting.
The powershell team considers it to be a low security level and prohibits this.

This is not the Powershell team's call; Of course the recommended method is using a key but some devices do not support this. Plain text credentials should always be supported. Period.

How is this BASIC feature available in every single SSH client known and unknown missing in Powershell?

You don't have to use New-PSSession. You can use ssh.exe "directly" with plain text credentials and then once you're on the remote device, fire up pwsh. Yeah, I know - not quite the same functionality as PS remoting. But I log into remote Linux devices by ssh'ing into them and then firing up pwsh far more than I use *-PSSession.

This issue has been marked as answered and has not had any activity for 1 day. It has been closed for housekeeping purposes.

@rkeithhill What you are proposing is NOT Powershell; You are mixing it with a external program.

I dont understand WHY this isnt implemented. Its something pretty basic and simple. There are some devices that simply DO NOT support passwordless SSH.

Please implement this into the cmdlet. Even if you require a SecureString

SecureString does not encrypt on macOS or Linux.

As a note, MSFT announced plans to resolve this in 7.0 milestone somehow.

Was this page helpful?
0 / 5 - 0 ratings