I have two files (both smaller than 5 KB) in a directory (MacOS). The first file (file1.txt
) was created by the root user and has file permissions -rw-------
. The second file (file2.txt
) was created by a regular user profile with file permissions -rw-r—-r—-
. When I try to upload file1.txt
(root-created file) to S3, the AWS console hangs and does not upload the file. When I try to upload file1.txt
to S3 via the AWS CLI, the command issues the error message "warning: Skipping file file1.txt
File/Directory is not readable.". When I try to upload file2.txt
(user account-created file) via the console, the file uploads successfully to S3.
Why does the root-created file not upload to S3? How can I upload this file to S3?
I tried to upload the root-created file to AWS S3 via both the console and CLI, and neither succeeded. I expected the file to upload successfully.
CodePudding user response:
It sounds like the issue is related to the file permissions of the root-created file. The file permissions of the root-created file are set to only allow the root user to read and write the file, which means that other users (including the user account used to access the AWS S3 service) do not have permission to read the file. This is likely why the file is not able to be uploaded to S3.
To fix this issue, you will need to change the file permissions of the root-created file to allow other users to read the file。 You can do this using the command in the terminal。 For example, the following command would allow all users to read and write the file:
chmod 666 file1.txt
Alternatively, you could set the file permissions to allow only the user account that will be uploading the file to S3 to read and write the file。 For example, the following command would allow only the user to read and write the file:
chmod 660 file1.txt
After changing the file permissions, you should be able to successfully upload the root-created file to S3。