Secure file transfer from Ionic to (AWS EC2) server

I’m trying to transfer a file from an Ionic iOS app to an AWS EC2 server running CentOS. I want this to be a secure file transfer. Will this plugin create a secure connection? I would assume not, since FTP isn’t secure. But if the server uses https would that make the FTP upload secure? If not, is there a way to securely transfer a file from an ionic app to a server?

For secure FTP navigation you will need to use an SFTP connection, I found this plugin it can help you with SFTP connection, but I think you will need to change your FTP server to accept secure connections and your ftp url will turn into sftp://server:port

1 Like

Thanks! Unfortunately it looks like it only supports Android. I found a plugin that not related to ionic or cordova, so it might be a little harder to integrate into my project, but hopefully it will work: Ionic is pretty awesome so thank you to everyone who is working on it! Hopefully a SFTP plugin is added to Ionic soon!

1 Like


Were you able to get that ssh2 sftp plugin working?? I really need this functionality for a project and would love to know if/how you got it working! Thanks so much.

Yep! I will post some info about it tonight. I ended up using a different library than the one I posted.

I found a plugin but I had trouble installing it, so I had to package it myself, then install it (link at bottom). The first part of the readme tells you how to install it. The second part is the original readme for the plugin which contains documentation for the methods. One thing to note is that it doesn’t support public key auth, so you have to use a username and password for a user on the server in order to run it. Note that I kinda dug this plugin up from nowhere and dusted it off in order to use it, so I’m not sure how secure it actually is. Its definitely no longer maintained, so you’ll have to judge for yourself if its suitable for your needs.

After you create a user on the server, you may have to do one more thing to allow username/password auth to the server. I was connecting to an Amazon EC2 server so this part might be slightly different on other servers.

  1. Open up the file /etc/ssh/sshd_config (probably need to open with sudo)
  2. Find the PasswordAuthentication line and make sure it says PasswordAuthentication yes
  3. Find the ChallengeResponseAuthentication line and make sure it says ChallengeResponseAuthentication=yes
  4. Save that file
  5. Run sudo service sshd restart

Then you should be good to go!

The plugin is here:

Hi Andrew, thanks for your efforts on this topic. I’m currently having this same issue, and tried using cordova-sftp-plugin and your own plugin but both gave me errors while adding the plugin to my own project:

Failed to fetch plugin via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: npm: Command failed with exit code 1 Error output:

If you know some way out of this please let me know. Thanks!

I’m mystified here. What are you trying to achieve that can’t be done with an ordinary HTTPS POST request?