0
我正在使用连接到我的ssh服务器,一些命令以su根开头,但我无法成功切换用户到root。如何使用posh-ssh(powershell)“sudo root”
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:\>
如何以root身份运行我的命令?