Python - Paramiko - sudo prompt

preview_player
Показать описание
Here is my take on as to how you can handle sudo prompts with paramiko.

Рекомендации по теме
Комментарии
Автор

Yes thank you so much for these great videos - finding out how to pass sudo in paramiko is very valuable

JakeCope-ivuy
Автор

hello how to handle the sudo username and password prompt using robot framework sshLiberary ?

ramprasadpatil
Автор

How to change the user to root with dzdo using paramiko?

uqu
Автор

I'm trying this, but on a device that askes for login, and then password, I tried this, it seens to send the login correcly, but even before it sendes the password it shows an login error in the log of the device, how can i Handle multiple prompts?

ewerton
Автор

With stdin.write we supply the sudo password, the output is also printing the "password". Can we get rid of that ? I want only output to be printed but not the password.

atanubanerjee
Автор

Im trying to switch to admin using this command but seems like its not working in python. Command= sudo su - fssoadmin then it should ask password...its not working.pls help me out

sunilveerendravattikuti
Автор

how to execute command using sudo bash.
like this:
command="sudo /bin/bash -c 'service apache2 status'"

shyamb.r
Автор

@R3ap3rPy I am trying the same thing with my code
cmd = " sudo -u " +tenant_name+ "-s\n"
stdin, stdout, stderr = self.client.exec_command(cmd, get_pty=True)
stdin.write(self.pwd + "\n")
stdin.flush()

except sudo is not working??
Any idea why??

jeezradz
Автор

How can we use a variable in stdin.write?

sidv
Автор

So real when I watched your video. Found some steps you made mistake and said to my self, why you don't know this ? :-)
I realize you make me feel like I also coding with you at the same time.
Thank anyway.

jacksvo