Hello I'm new in Python,
My code :
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=ip, port=port, username=username, password=password,
timeout=timeOut, key_filename=os.path.join(os.path.expanduser('~'), ".ssh", sshKeyName))
for i in range(len(myYml)):
for module, value in myYml[i].items():
if module == "module" and value == "copy":
print('copy exist')
client.exec_command('sudo cp -r ./Public /var/www/public')
Machine : local (MacOS) and VM (Debian)
What I'm trying to do: I want to execute a shell command in my VM when I launch my script in my local.
Problem ? In the last line (exec_command), when I try 'touch test', it create my file in my VM BUT when I try to execute a command with 'sudo', 'cp', 'sudo touch test' nothing happen in my VM.