Connect to Amazon EC2 file directory using Filezilla and SFTP
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:
- Edit (Preferences) > Settings > Connection > SFTP, Click "Add key file”
- Browse to the location of your .pem file and select it.
- 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.
- 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.
-
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.)
-
Just download your FileZilla (I'm using macOS - and downloaded the free version, that's good enough)
-
Open Site Manager in FileZilla (⌘S) -> New Site
- 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
- For the Key file field, browse your pem file: and click Connect
- 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 ;-)
Eric Brotto
Updated on October 20, 2021Comments
-
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 about 10 yearsfor free tier ubuntu distributions username will be ubuntu.
-
rahul almost 10 yearsTo 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 over 9 yearsSaved me there @streak
-
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 about 9 yearsCannot 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 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 about 9 yearsI 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 about 9 yearsCheck this article from amazon, in case if you need to install filezilla server codeproject.com/Tips/404132/…
-
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 almost 9 yearsIts always a joy when the instruction work like a charm. Thank you
-
PhantomReference over 8 yearsAppreciate taking the timeout to list the steps accurately!
-
It's a trap almost 8 yearsI am seeing empty directory listing. I want to edit the wp-config.php . Can you tell me how to find that file?
-
Shehzad Nizamani almost 8 yearsYou can use puttygen to create .ppk and use that .ppk file as key.
-
nh-labs almost 8 yearsI crosslinked to an url on stackoverflow. I do not consider this an external link, do you?
-
mnutsch over 7 yearsThis solved a problem that I had. Thanks for posting it!
-
Leonardo about 7 yearsThank you. @YasithaChinthaka
-
karthick about 7 yearsAdd 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 almost 7 yearsIf 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
underNETWORK & SECURITY
and select your Group and clickEdit inbound rules
fromActions
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 over 6 yearsI was having no success on RedHat and the user name is "ec2-user".
-
red888 over 5 yearswhere does it store the aws keys? does it encrypt them on disk for you or in plain text?
-
red888 over 5 yearsdoes filezilla encrypt the aws keys on disk or store in plain text?
-
Elshan over 5 yearsI 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 about 5 yearsFor WordPress users with the most used WordPress Certified by Bitnami installation, it is on a Ubuntu server and therefore the username ubuntu :)
-
Elshan about 5 yearsFilezilla also have sftp
-
Dineshmohan almost 5 yearsWorked like a charm
-
Bennybear over 4 yearsThis 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 about 4 yearsSame issue with
filezilla 3.7
. The sftp command-line tool worked for me, too. -
Barry DeCicco over 3 yearsKilian's methods worked for me. The FileZilla method returns the error: FATAL ERROR: No supported authentication methods available (server sent: publickey)
-
Barry DeCicco over 3 yearsEbuzer, 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 over 3 yearsIf you are unable to use .pem file then convert to .ppk. stackoverflow.com/a/59491738/11000016
-
Santosh over 3 yearsFor linux 2 the user is
ec2-user
-
Wouter over 2 yearsFor AWS using the WordPress Bitnami image the user name was ubuntu for me
-
subhashis over 2 yearsMy filezila does not shows me SFTP-SSH file transfer option option (Linux)