text: Hi,
  how to do "sudo -s" and access root terminal with paramiko module
  or
  please suggest me any other module.
  Thanks,
  Pragva.
  Hi,
  how to do "sudo -s" and access root terminal with paramiko module
  or
  please suggest me any other module.
  Thanks,
  Pragva.
  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.
  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
  [root@f16 ~]#
  Is it possible to achieve with fabric!!!!!
  I got it with paramiko.
  from paramiko import SSHClient, SSHConfig
  ssh_client = SSHClient()
  ssh_client.load_system_host_keys()
  ssh_client.connect('localhost', username='user1',password='pass123')
  chan = ssh_client.invoke_shell()
  chan.send("sudo -s\n")
  buff = ' '
  while not buff.endswith("password: "):
  ...resp = chan.recv(9999)
  ...buff += resp
  print buff
  print "before pwd entered."
  chan.send("pass123\n")
  print "pwd entered"
  Thanks for the replies