I am trying to run sesu
command in Unix server from Python with the help of Paramiko exec_command
. However when I am running this command exec_command('sesu test')
, I am getting
sh: sesu: not found
When I am running simple ls
command it giving me desired output. Only with sesu
command it is not working fine.
This is how my code looks like:
import paramiko
host = host
username = username
password = password
port = port
ssh=paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip,port,username,password)
stdin,stdout,stderr=ssh.exec_command('sesu test')
stdin.write('Password')
stdin.flush()
outlines=stdout.readlines()
resp=''.join(outlines)
print(resp)