Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. VOXL SDK and Software
  3. Issues with SFTP with python

Issues with SFTP with python

Scheduled Pinned Locked Moved Unsolved VOXL SDK and Software
2 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • José QuintanillaJ Offline
    José QuintanillaJ Offline
    José Quintanilla
    Regular
    wrote on last edited by
    #1

    drone m500
    If I try to use scp command line (which use ssh) in ubuntu terminal to copy a file into the drone it is possible and does not give any error but while trying to use SFTP in python with paramiko or pysftp throws an error and does not allow me to send it through the own drones's wifi.

    Port 22 for SSH is open in drone. Turned off and back on tried. Hostname, password and usarname double-checked.

    Any other idea of how can I copy/transfer a file from the PC to the drone? I want to automate this process

    # create SSH client
    client = paramiko.SSHClient()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    
     # connect to the drone
     client.connect(hostname=hostname, username=username, password=password)
     print("SSH connection established")
    
    sftp = client.open_sftp()
    sftp.put(file_path,drone_path)
    sftp.close()
    time.sleep(2)
    print("File in drone")
    
    # close the SSH connection
    client.close()
    print("SSH connection closed")
    
    1 Reply Last reply
    0
    • Alex KushleyevA Offline
      Alex KushleyevA Offline
      Alex Kushleyev
      ModalAI Team
      wrote on last edited by Alex Kushleyev
      #2

      I believe you first need to enable SFTP functionality in ssh server on the drone, for example https://www.pcwdld.com/setup-sftp-server-on-ubuntu seems to provide instructions (i did not verify the correctness of the instructions).

      A better solution, in my opinion, would be to use scp from your python client. You can copy the ssh key directly to the drone, so you don't have to enter the password in the script. Then you could call the scp command directly from Python using a system call or using Paramiko like in this example : https://stackoverflow.com/questions/250283/how-to-scp-in-python . Installing the ssh key on the drone will avoid storing plain text password on your PC.

      Is there a reason why you are trying SFTP instead of SCP?

      1 Reply Last reply
      0

      Reading along? Create a free ModalAI Forum account to join in.

      With an account you can reply, ask your own question, get an email when a ModalAI engineer answers, and mark the reply that solved it. Your place in each thread is saved between visits.

      Questions about VOXL, Flight Core, ESCs and ModalAI drones are answered here by the engineers who build them.

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      ModalAI
      Categories Recent Tags ModalAI.com Docs
      © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups