-1

1 - Verified whether paramiko code able to connect to instance with sudo access 2 - After above succesful run, I tried to execute this command -

ssh_client.exec_command(command)

command = sudo su - abc -c 'sftp -o <path to ssh key> -o Port=22 <username@server.com>'

Question - Do not see any output script gets stuck.

I have also looked into doc - pysftp doc and paramiko doc

Any suggestion appreciated thank you

dev
  • 15
  • 5

1 Answers1

1

Try one of the two solutions:

command = "sudo -S - abc -c 'sftp -o <path to ssh key> -o Port=22 <username@server.com>"

Or

command = 'rsync -avz --rsh="sshpass -p password ssh -l username -o StrictHostKeyChecking=no" server.com:remote_path local_path'
dreamzboy
  • 795
  • 15
  • 31