384

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.

Eric Brotto
  • 53,471
  • 32
  • 129
  • 174
  • 4
    So what is the question? If you have SSH/SFTP credentials, simply use FileZilla and connect to the site? Open the Site Manager, add your site (select SFTP as protocol) and store it. Make Site Manager open up each time you open FileZilla, so you just have to double-click on the Site Manager item. – Shi May 25 '13 at 22:45
  • 3
    Any specified problem you are having with your task? – Martin Prikryl May 27 '13 at 07:07

15 Answers15

868

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.

petezurich
  • 9,280
  • 9
  • 43
  • 57
Yasitha Waduge
  • 13,180
  • 5
  • 35
  • 42
  • 4
    for free tier ubuntu distributions username will be ubuntu. – streak Apr 30 '14 at 10:48
  • 7
    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. – rahul Jul 07 '14 at 01:01
  • 1
    @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? – user2363025 Apr 22 '15 at 08:24
  • 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... – Yasitha Waduge Apr 22 '15 at 09:18
  • @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.. – user2363025 Apr 22 '15 at 10:59
  • 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.. http://superuser.com/questions/811527/filezilla-ftp-to-aws-ec2-windows-server-2012-instance-failed-to-retrieve-direct – Yasitha Waduge Apr 22 '15 at 12:52
  • Check this article from amazon, in case if you need to install filezilla server http://www.codeproject.com/Tips/404132/Amazon-AWS-Setting-up-FTP-on-EC-Windows-Instances – Yasitha Waduge Apr 22 '15 at 12:54
  • @Yasitha Chinthaka I can't see anywhere to find what the username should be. The article supplied is for ftp. I need sftp – user2363025 Apr 22 '15 at 13:25
  • I am seeing empty directory listing. I want to edit the wp-config.php . Can you tell me how to find that file? – It's a trap Jun 12 '16 at 05:18
  • You can use puttygen to create .ppk and use that .ppk file as key. – Shehzad Nizamani Jun 25 '16 at 20:50
  • 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` – karthick Apr 21 '17 at 18:18
  • 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. – AGMG Jul 18 '17 at 09:16
  • where does it store the aws keys? does it encrypt them on disk for you or in plain text? – red888 Jan 21 '19 at 22:08
76

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

Elshan
  • 7,339
  • 4
  • 71
  • 106
  • does filezilla encrypt the aws keys on disk or store in plain text? – red888 Jan 21 '19 at 22:08
  • 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. – Elshan Jan 21 '19 at 23:06
  • 3
    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. – Bennybear Dec 23 '19 at 05:13
  • If you are unable to use .pem file then convert to .ppk. https://stackoverflow.com/a/59491738/11000016 – U.A Nov 23 '20 at 06:12
  • 1
    For linux 2 the user is `ec2-user` – Santosh Dec 11 '20 at 16:27
  • 1
    For AWS using the WordPress Bitnami image the user name was ubuntu for me – Wouter Aug 13 '21 at 20:29
  • My filezila does not shows me SFTP-SSH file transfer option option (Linux) – subhashis Oct 19 '21 at 09:14
23

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."

Jerad
  • 594
  • 7
  • 15
21

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

TJ Tang
  • 221
  • 2
  • 3
9

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 ;-)

Lucio Mollinedo
  • 2,295
  • 1
  • 33
  • 28
6

FileZilla did not work for me, I kept getting this error:

Disconnected: No supported authentication methods available (server sent: publickey)

What did work was the sftp command.

Connect with the EC2 Instance with

sftp -i "path/to/key.pem" ec2-user@ec2-54-212-34-84.us-west-2.compute.amazonaws.com

Downloading files / dirs

To download path/to/source/file.txt and path/to/source/dir:

lcd ~/Desktop
cd path/to/source
get file.txt
get -r dir

Uploading files / dirs

To upload localpath/to/source/file.txt and ~/localpath/to/source/dir to remotepath/to/dest:

lcd localpath/to/source
cd remotepath/to/dest
put file.txt
put -r dir
Kilian Obermeier
  • 6,678
  • 4
  • 38
  • 50
4

You can use any FTP client. I use winscp and it works just fine. In all these clients; you can specify the ssh secure key.

Deepak Singhal
  • 10,568
  • 11
  • 59
  • 98
0

Old question but what I've found is that, all you need is to add the ppk file. Settings -> Connections -> SFTP -> Add keyfile User name and the host is same as what you would provide when using putty which is mentioned in http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-connect-to-instance-linux.html Might help someone.

xelber
  • 4,197
  • 3
  • 25
  • 33
0

In my case, Filezilla sends the AWS ppk file to every other FTP server I try to securely connect to.

That's crazy. There's a workaround as written below but it's ugly.

It does not behave well as @Lucio M pointed out.

From this discussion: https://forum.filezilla-project.org/viewtopic.php?t=30605

n0lqu:

Agreed. However, given I can't control the operation of the server, is there any way to specify within FileZilla that a site should authenticate with a password rather than key, or vice-versa? Or tell it to try password first, then key only if password fails? It appears to me it's trying key first, and then not getting a chance to try password.

botg(Filezilla admin) replied:

There's no such option.

n0lqu:

Could such an option be added, or are there any good workarounds anyone can recommend? Right now, the only workaround I know is to delete the key from general preferences, add it back only when connecting to the specific site that requires it, then deleting it again when done so it doesn't mess up other sites.

botg:

Right now you could have two FileZilla instances with separate config dirs (e. g. one installed and one portable).

timboskratch:

I just had this same issue today and managed to resolve it by changing the "logon type" of the connection using a password in the site manager. Instead of "Normal" I could select either "Interactive" or "Ask for Password" (not really sure what the difference is) and then when I tried to connect to the site again it gave me a prompt to enter my password and then connected successfully. It's not ideal as it means you have to remember and re-type you password every time you connect, but better than having to install 2 instances of FileZilla. I totally agree that it would be very useful in the Site Manager to have full options of how you would like FileZilla to connect to each site which is set up (whether to use a password, key, etc.) Hope this is helpful! Tim

Also see: https://forum.filezilla-project.org/viewtopic.php?t=34676

So, it seems:

For multiple FTP sites with keys / passwords, use multiple Filezilla installs, OR, use the same ppk key for all servers.

I wish there was a way to tell FileZilla which ppk is for which site in Site Manger

site80443
  • 190
  • 5
  • 10
0

the most simple and straight forward is to create a FTP login. Here is a little and easy to understand tutorial site on stackoverflow itself, how to set things up in 2min... Setting up FTP on Amazon Cloud Server

Community
  • 1
  • 1
nh-labs
  • 641
  • 7
  • 10
0

First of all Filezilla is an FTP/SFTP client/server. We will need to use the client for this purpose.

1) Download the client from the URL: https://filezilla-project.org/

2) Go to AWS management console and then EC2. Select the instance that you want to access and then copy the DNS or IP address of the instance and then paste it in Filezilla host name.

Follow Image: Amazon Instance Access via FileZilla

3) Then, enter the username for the instance that you have created, For Amazon-ami it will be ec2-user and for other OS it would be different. Then, enter the password and port which will be 21 or 22.

4) Then, it will ask for the key, which is in pem format just select the .pem file and then it will confirm authentication. Click on Yes and then you are Done.

Note: In your EC2 Security group allow port number 21 and 22 whichever required for FTP access.

Patrick R
  • 6,621
  • 1
  • 24
  • 27
0

all you have to do is: 1. open site manager on filezilla 2. add new site 3. give host address and port if port is not default port 4. communnication type: SFTP 5. session type key file 6. put username 7. choose key file directory but beware on windows file explorer looks for ppk file as default choose all files on dropdown then choose your pem file and you are good to go.

since you add new site and configured next time when you want to connect just choose your saved site and connect. That is it.

  • Ebuzer, this results in the error: "FATAL ERROR: No supported authentication methods available (server sent: publickey)" That's a variation on Kilian's message. – Barry DeCicco Nov 19 '20 at 15:54
0

If you are comfortable using command lines, and use git bash to ssh to remote server (ubuntu, etc) from your PC, you may use sftp as below, works great always, and seems very fast. The pem file can be downloaded from aws EC2 or Lightsail, or any server. In the below command replace the path/namd of the pem file. Also replace the IP address to that of remote server [say remote Unix or linux/ubuntu server.]

$ sftp -i /c/Users/pat/Downloads/LightsailDefaultKey-us-east-1-2.pem ubuntu@123.45.6789

Additional commands for actual upload/download using sftp Go to remote folder sftp> pwd sftp> cd /home/ubuntu/mymedia

Go to local folder sftp> lpwd Local working directory: / sftp> lcd /c/Users/pat/Desktop/Camtasia To upload local files to server sftp> put *
Or use get if you need to download to your local PC sftp> get *

Note: this is similar to the ssh to connect to remote using pem file. $ ssh -i /c/Users/pat/Downloads/LightsailDefaultKey-us-east-1-2.pem ubuntu@123.45.6789

Thanks!

Pat
  • 325
  • 2
  • 11
0

For Ubuntu users, there is another way of making and setting up a key without PuttyGen. I assume that you can connect to the server via terminal and want to set up FileZilla for file transferring.

In terminal execute the command:

ssh-keygen

It will prompt you to enter the destination path for the private and public keys files, by default it's

/home/user/.ssh/id_rsa and /home/user/.ssh/id_rsa.pub

you can leave it as is. Then, open the public key and copy its content:

cat .ssh/id_rsa.pub

In the terminal, on the server-side, open the .ssh/authorized_keys and paste the copied line there:

nano .ssh/authorized_keys

You will probably see there some present lines like "ssh-rsa AAAAB3Nz...". It's okay. Simply put the new line and paste the line copied before.

Aidos
  • 729
  • 7
  • 20
-6

https://www.cloudjojo.com/how-to-connect-ec2-machine-with-ftp/

  1. First you have to install some ftp server on your ec2 machine like vsftpd.
  2. Configure vsftpd config file to allow writes and open ports.
  3. Create user for ftp client.
  4. Connect with ftp client like filezilla.

Make sure you open port 21 on aws security group.