拒绝 Amazon AWS Filezilla 传输许可

我已经运行了我的 Amazon AWS 实例,测试页面已经打开。

我试图 SFTP 文件到服务器显示我的网站。我已经将 Filezilla 连接到 AWS 服务器,但是当我试图将文件从本地机器移动到/var/www/html 目录时,它说权限被拒绝。

我刚刚发现我可以把文件移动到/home/ec2-user 目录。我猜我的文件在服务器上。但是当我试图将它们从那里移动到/var/www/html 目录时,它仍然不会移动它们,权限被拒绝。

我已经研究这个大约2个小时了但是我还没有找到这个问题的答案。

非常感谢你的帮助,我就快成功了! 哈哈

谢谢

更新

enter image description here

135174 次浏览

To allow user ec2-user (Amazon AWS) write access to the public web directory (/var/www/html),
enter this command via Putty or Terminal, as the root user sudo:

sudo chown -R ec2-user /var/www/html

Make sure permissions on that entire folder were correct:

sudo chmod -R 755 /var/www/html

Doc's:

Setting up amazon ec2-instances

Connect to Amazon EC2 file directory using Filezilla and SFTP (Video)

Understanding and Using File Permissions

In my case the /var/www/html in not a directory but a symbolic link to the /var/app/current, so you should change the real directoy ie /var/app/current:

sudo chown -R ec2-user /var/app/current
sudo chmod -R 755 /var/app/current

I hope this save some of your times :)

if you are using centOs then use

sudo chown -R centos:centos /var/www/html


sudo chmod -R 755 /var/www/html

For Ubuntu

sudo chown -R ubuntu:ubuntu /var/www/html


sudo chmod -R 755 /var/www/html

For Amazon ami

sudo chown -R ec2-user:ec2-user /var/www/html


sudo chmod -R 755 /var/www/html

In my case, after 30 minutes changing permissions, got into account that the XLSX file I was trying to transfer was still open in Excel.

If you're using Ubuntu then use the following:

sudo chown -R ubuntu /var/www/html


sudo chmod -R 755 /var/www/html

for me below worked:

chown -R ftpusername /var/app/current

This work best everyone

chmod ugo+rwx your-folder

https://help.ubuntu.com/community/FilePermissions