What I've tried:
invoke_shell()
then channel.send
su
and then sending the password resulted in not being root
invoke_shell()
and then channel.exec_command
resulted in a "Channel Closed" error
_transport.open_session()
then channel.exec_command
resulted in not being root
invoke_shell()
then writing to stdin and flushing it resulted in not being root
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…