I'm using Paramiko (newbie) to connect to a linux server. I'm able to connect to the server an execute different commands (such as 'ls', 'uptime') and to read the results. However, when trying to execute the 'sudo -iu' command (doesn't require a password), the Paramiko hangs. Here is the relevant code lines:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy (paramiko.AutoAddPolicy())
sh.connect (server, username='aaaa', password= 'bbbbb', key_filename='C:\\Users\\aaaa\\Documents\\paramiko_dsa_key')
stdin, stdout, stderr = ssh.exec_command("sudo -iu aaauser")
#stdin, stdout, stderr = ssh.exec_command("uptime")
print stdout.read()
Note, that there are no issues running these commands using known SSH tools such as Xshell.
Thanks in advance, Tal