Ich benutze posh-ssh zu meinem ssh Server verbinden einige Befehle starten mit su root, aber ich kann nicht Benutzer root erfolgreich wechseln.Wie zu "sudo root" mit Posh-SSH (Powershell)
PS C:\> $rootpwdSec = ConvertTo-SecureString $rootpwd -AsPlainText -Force
PS C:\> Invoke-SSHStreamExpectSecureAction -Command 'su ' -ExpectString 'Password:' -SecureAction $rootpwdSec -ShellStream $stream
True
PS C:\> $stream.read();
[[email protected] admin]#
PS C:\> Invoke-SSHCommandStream -SessionId $SessionId -Command 'id'
uid=500(admin) gid=500(admin) groups=500(admin) context=user_u:system_r:unconfined_t
PS C:\>
wie kann ich meinen Befehl als root ausführen?