February 19th, 2013, 11:42 AM
How to do "sudo -s" and access root terminal.
how to do "sudo -s" and access root terminal with paramiko module
please suggest me any other module.
February 19th, 2013, 03:02 PM
Is there a specific command you want to run with sudo? Can you run your script with sudo or as root to avoid handling it with the script?
You can execute arbitrary shell commands with the subprocess module.
February 19th, 2013, 11:50 PM
Thanks for the reply.
We are using power broker for server root auth it something like below.
I 'm able to login f16 as normal user to do some tasks as root, i have to run "pbrun vmgrp -u root -p" and access the root terminal
It's something like below and want to do with python as of now i'm using paramiko somebody suggested me to do with getpty() still issues.
[pragva@f17 ~]$ ssh f16
Last login: Tue Feb 19 11:19:36 2013 from localhost
[pragva@f16 ~]$ pbrun vmgrp -u root -p
su from pragva to root at Wed Feb 20 05:42:19 IST 2013
February 20th, 2013, 03:32 AM
Is it possible to achieve with fabric!!!!!
February 21st, 2013, 05:55 AM
I got it with paramiko.
from paramiko import SSHClient, SSHConfig
ssh_client = SSHClient()
chan = ssh_client.invoke_shell()
buff = ' '
while not buff.endswith("password: "):
...resp = chan.recv(9999)
...buff += resp
print "before pwd entered."
print "pwd entered"
Thanks for the replies