Python paramiko executing sudo

Viewed 6293

I am using paramiko put method to send file from local to remote server. However, I am having problem executing sudo su - user command to view the file from remote. I also tried changing the permission from local but the file permission stays intact when transferred.

import paramiko

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

ssh.connect(<Host>, username=<User Name>, password=<Password)

sftp = ssh.open_sftp()
sftp.put(<Source>, <Destination>)
sftp.close()

Is there a way to execute sudo su - user command using paramkio so the transferred files can be read from remote?

Thank you!

1 Answers
Related