How to upload files to Lightsail instance using ftp program?

0

Hello Forum;

Question: What are the criteria needed to upload files to a Lightsail instance using an ftp program like FileZilla or Notepad++?

I can connect and download files just fine. However, neither ftp program (i.e. FileZilla or Notepad++) will let me upload any files. Below is what the ftp programs say when I try to upload files:

  • FileZilla says "open for write: permission denied"
  • Notepad++ just says "failed" when I try to upload a file.

I can change the permissions for a file to "777" or rwxrwxrwx and can upload to that file. However, that is only a temporary fix. Obviously, I will eventually need more secure file permissions.

Below is the connection criteria that I am using:

  • Protocol: SFTP
  • Host: xx.xx.xx.xx (static IP address assigned to my Lightsail instance)
  • User: ec2-user
  • Key file: LightsailDefaultKey-us-east-2.pem (downlloaded from Lightsail -> Connect -> Download defaut key

I have tried to change permissions for the IAM user using these instructions but have had no success (Managing access to Amazon Lightsail for an IAM user):
https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-managing-access-for-an-iam-user

I have spent days trying to figure out this problem and am about at wits end.

I would appreciate if someone could help me with my problem.

Thank you in advance.

asked a year ago809 views
2 Answers
0

It is possible that the directory where the file is placed does not have write permission for ec2-user.
I believe that this can be handled by adding ec2-user to the ownership group of the directory where you are trying to place the file or the file you are trying to replace, or by changing the owner of the directory or file to ec2-user.

For example, to add a group to ec2-user, execute the following command.
Replace "GroupName" with the name of the group that owns the directory or file.

sudo usermod -aG GroupName ec2-user

The group name can be checked with the following command.

ls -la

The results can be checked as follows.
UserName is the user who owns the file or directory and GroupName is the group that owns it.

drwxr-xr-x 1 UserName GroupName     4096 Mar 10 20:27 aws
profile picture
EXPERT
answered a year ago
0

Looking back at your question last week from the screengtrabs we can see that when you make an SFTP connection you are placed into the directory /home/ec2-user - is that still correct today?

Is this the directory you're having problems writing files to?

If it is then double-check the permissions on the directory - connect to the host by SSH and ls -lasd /home/ec2-user (or if it's not that directory which is giving you trouble then run the same command against the name of the directory in question).

When you're trying to upload a file, is there already a file of the same name in the directory that you're trying to upload to? And if there is a file that's currently there then what are the permissions on that file?

profile picture
EXPERT
Steve_M
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions