Connect to Amazon EC2 file directory using Filezilla and SFTP

476,530

Solution 1

I've created a video tutorial for this. Just check:

Connect to Amazon EC2 file directory using FileZilla and SFTP, Video Tutorial

Summary of above video tutorial:

  1. Edit (Preferences) > Settings > Connection > SFTP, Click "Add key file”
  2. Browse to the location of your .pem file and select it.
  3. A message box will appear asking your permission to convert the file into ppk format. Click Yes, then give the file a name and store it somewhere.
  4. If the new file is shown in the list of Keyfiles, then continue to the next step. If not, then click "Add keyfile..." and select the converted file.
  5. File > Site Manager Add a new site with the following parameters:

    Host: Your public DNS name of your EC2 instance, or the public IP address of the server.

    Protocol: SFTP

    Logon Type: Normal

    User: From the docs: "For Amazon Linux, the default user name is ec2-user. For RHEL5, the user name is often root but might be ec2-user. For Ubuntu, the user name is ubuntu. For SUSE Linux, the user name is root. For Debian, the user name is admin. Otherwise, check with your AMI provider."

    Press Connect Button - If saving of passwords has been disabled, you will be prompted that the logon type will be changed to 'Ask for password'. Say 'OK' and when connecting, at the password prompt push 'OK' without entering a password to proceed past the dialog.

    Note: FileZilla automatically figures out which key to use. You do not need to specify the key after importing it as described above.

If you use Cyberduck follow this.

Check this post if you have any permission issues.

Solution 2

This is very simple if you used your pem file ( I am using macOS / windows users can follow the same steps.)

  1. Just download your FileZilla (I'm using macOS - and downloaded the free version, that's good enough)

  2. Open Site Manager in FileZilla (⌘S) -> New Site

enter image description here

  1. Put your hostname in the Host field.

Example: eca-**-**-**-111.ap-southwest-9.compute.amazonaws.com

  • Select Protocol as SFTP - SSH File Transfer Protocol

  • Select Logon type as Key File

  • Put your user name in the User field : for me it's ubuntu (find your ssh user)

Note:

OS vs Username

Amazon - ec2-user

Centos - centos

Debian - admin or root

Fedora - ec2-user

RHEL - ec2-user or root

SUSE - ec2-user or root

Ubuntu - ubuntu or root

  1. For the Key file field, browse your pem file: and click Connect

enter image description here

  1. That's all :) have fun!

Note:

(Remember to allow SSH connection to your IP address from EC2) If not you will get connecting error message!

Note: Allowing your IP to connect your AWS instance via SFTP

EC2 -> SecurityGroups -> SSH -> Inbound rules -> Edit -> Add Rule ( SSH|TCP|22|My IP(it's get ip automatically | name for rule) -> Save

Solution 3

If anyone is following all the steps and having no success, make sure that you are using the correct user. I was attempting to use "ec2-user" but I needed to use "ubuntu."

Solution 4

Make sure you use port 22. Filezilla will default to port 21 for SFTP.

Solution 5

Just one minor note to the well explained accepted answer of Yasitha Chinthaka:

Note: FileZilla automatically figures out which key to use. You do not need to specify the key after importing it as described above.

In my case I already had other 5 ppks from other instances that I was using in the past (with the ppk of the new instance being at the bottom of that list). I added the new ppk of my new instance, and it wouldn't let me connect to it. The error message: too many tries / attempts.

After I deleted the unused ppks, I was finally able to login to the instance.

So no, Filezilla is not that smart ;-)

Share:
476,530
Eric Brotto
Author by

Eric Brotto

Updated on October 20, 2021

Comments

  • Eric Brotto
    Eric Brotto over 2 years

    I have created an AWS EC2 Instance and I want to be able to upload files to the server directory using FileZilla in the simplest and most straightforward fashion possible.

  • streak
    streak about 10 years
    for free tier ubuntu distributions username will be ubuntu.
  • rahul
    rahul almost 10 years
    To add to what was mentioned above make sure you delete the default value of 21 in port text box (default for sftp) as it seems to work with port 22. It started working for me when I deleted the port.
  • Abram
    Abram over 9 years
    Saved me there @streak
  • user2363025
    user2363025 about 9 years
    @Yasitha Chinthaka I have followed all steps but cannot connect to my instance. It is a large instance on Windows server 2012. Any help appreciated. I have added the inbound rule for SSH on my security group. Is there any other configuration needed or changes since you last posted this answer?
  • Yasitha Waduge
    Yasitha Waduge about 9 years
    Cannot connect as in, what kind of error message you get? I haven't tried this with Windows server though, but should be the same procedure.. make sure your username is correct...
  • user2363025
    user2363025 about 9 years
    @Yasitha Chinthaka I am getting back: Error: Connection refused Error: Could not connect to server. I am trying with a user of ec2-user for windows. I also tried root. neither would connect..
  • Yasitha Waduge
    Yasitha Waduge about 9 years
    I guess there should be some issue with your username. it should be something other than ec2-user or root. Just read this post, you might get some clues.. somehow try to confirm your username first.. superuser.com/questions/811527/…
  • Yasitha Waduge
    Yasitha Waduge about 9 years
    Check this article from amazon, in case if you need to install filezilla server codeproject.com/Tips/404132/…
  • user2363025
    user2363025 about 9 years
    @Yasitha Chinthaka I can't see anywhere to find what the username should be. The article supplied is for ftp. I need sftp
  • Abhilash Cherukat
    Abhilash Cherukat almost 9 years
    Its always a joy when the instruction work like a charm. Thank you
  • PhantomReference
    PhantomReference over 8 years
    Appreciate taking the timeout to list the steps accurately!
  • It's a trap
    It's a trap almost 8 years
    I am seeing empty directory listing. I want to edit the wp-config.php . Can you tell me how to find that file?
  • Shehzad Nizamani
    Shehzad Nizamani almost 8 years
    You can use puttygen to create .ppk and use that .ppk file as key.
  • nh-labs
    nh-labs almost 8 years
    I crosslinked to an url on stackoverflow. I do not consider this an external link, do you?
  • mnutsch
    mnutsch over 7 years
    This solved a problem that I had. Thanks for posting it!
  • Leonardo
    Leonardo about 7 years
    Thank you. @YasithaChinthaka
  • karthick
    karthick about 7 years
    Add below Line in the ec2 box into “sudo nano /etc/ssh/sshd_config” file. All the way to the end of the file. Subsystem sftp internal-sftp
  • AGMG
    AGMG almost 7 years
    If you still can't connect, you have to add your IP/ IP range or Anywhere (not recommended, only use for a short period of time in test environments) as the Source for SSH in your instance's Security Group inbound rules. To do that go to log into AWS, go to EC2 section and click on Security Groups under NETWORK & SECURITY and select your Group and click Edit inbound rules from Actions dropdown menu. Then you can add a new rule for SSH. Also you can add your Key File directly as the 'Logon Type' in Step 5 instead of adding it in Edit --> Settings with current versions of FileZilla.
  • NOTiFY
    NOTiFY over 6 years
    I was having no success on RedHat and the user name is "ec2-user".
  • red888
    red888 over 5 years
    where does it store the aws keys? does it encrypt them on disk for you or in plain text?
  • red888
    red888 over 5 years
    does filezilla encrypt the aws keys on disk or store in plain text?
  • Elshan
    Elshan over 5 years
    I reckon key file is already encrypted, therefore it just pass the file as it is. not encrypted. But if you are using normal authentication using username and password with Filezilla then they encrypt the password.
  • Peter Højlund Palluth
    Peter Højlund Palluth about 5 years
    For WordPress users with the most used WordPress Certified by Bitnami installation, it is on a Ubuntu server and therefore the username ubuntu :)
  • Elshan
    Elshan about 5 years
    Filezilla also have sftp
  • Dineshmohan
    Dineshmohan almost 5 years
    Worked like a charm
  • Bennybear
    Bennybear over 4 years
    This is great, but wanted to add a note: instead of using the public hostname, I used the IPv4 IP address, for the Host input. That's when it worked for me.
  • Soheil Pourbafrani
    Soheil Pourbafrani about 4 years
    Same issue with filezilla 3.7. The sftp command-line tool worked for me, too.
  • Barry DeCicco
    Barry DeCicco over 3 years
    Kilian's methods worked for me. The FileZilla method returns the error: FATAL ERROR: No supported authentication methods available (server sent: publickey)
  • Barry DeCicco
    Barry DeCicco over 3 years
    Ebuzer, this results in the error: "FATAL ERROR: No supported authentication methods available (server sent: publickey)" That's a variation on Kilian's message.
  • U.A
    U.A over 3 years
    If you are unable to use .pem file then convert to .ppk. stackoverflow.com/a/59491738/11000016
  • Santosh
    Santosh over 3 years
    For linux 2 the user is ec2-user
  • Wouter
    Wouter over 2 years
    For AWS using the WordPress Bitnami image the user name was ubuntu for me
  • subhashis
    subhashis over 2 years
    My filezila does not shows me SFTP-SSH file transfer option option (Linux)