How do I use Paramiko and sudo
to run chmod 775
?
Code snippet:
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
r_pass = getpass.getpass(prompt='Remote password? ')
ssh_client.connect(r_ip, username=r_name, password=r_pass)
ftp = ssh_client.open_sftp()
for fn in files:
print("sending {} of {}".format(count, len(files)))
ftp.put(fn, posixpath.join(r_path_mark, fn))
ftp.chmod(r_path_mark+fn, 0o775)
The very last ftp.chmod
command results in a "permission denied".