2016-07-19 37 views
0

我使用CFT创建了一个Apache web服务器;这是使用RHEL 7.为了允许EC2用户修改文档的apache根文件夹的文件,我加入CFT(来自无功/日志/云init.log截取)ec2用户没有权限写入web文件夹

Jun 30 16:11:15 ip-10-205-0-135 cloud-init: groupadd www Jun 30 16:11:16 ip-10-205-0-135 cloud-init: usermod -a -G www ec2-user Jun 30 16:11:16 ip-10-205-0-135 cloud-init: chown -R root:www /var/www Jun 30 16:11:16 ip-10-205-0-135 cloud-init: chmod 2775 /var/www Jun 30 16:11:16 ip-10-205-0-135 cloud-init: find /var/www -type d -exec chmod 2775 {} \; Jun 30 16:11:16 ip-10-205-0-135 cloud-init: find /var/www -type f -exec chmod 0664 {} \; 

正如在以下从日志中可以看到,这很好。然而,在EC2登录时,它给的权限如下错误:

[[email protected] html]$ aws s3 sync s3://gfrepo/releases releases download failed: s3://gfrepo/releases/binaries.html to releases/binaries.html [Errno 13] Permission denied: u'/var/www/html/releases/binaries.html' download failed: s3://gfrepo/releases/B1556013/B1556013.jar to releases/B1556013/B1556013.jar Could not create directory /var/www/html/releases/B1556013: [Errno 13] Permission denied: '/var/www/html/releases/B1556013' 

我结束了我的提升作为许可sudo来完成S3同步。不知道为什么它为ec2用户授予权限错误。这里有权限上市:

[[email protected] www]$ ls -l total 0 
drwxrwsr-x. 2 root www 6 Mar 21 02:33 cgi-bin 
drwxrwsr-x. 3 root www 55 Jun 30 16:11 html 

[[email protected] www]$ groups ec2-user 
ec2-user : ec2-user adm wheel systemd-journal www 

正如你可以看到EC2用户是WWW组和WWW的一部分是HTML的所有者子DIR

+0

对于ec2用户能够写入文档根目录,它需要成为www-data组的成员 – error2007s

+0

它是; [ec2-user @ ip-10-206-32-92 html] $ groups ec2-user ec2-user:ec2-user adm wheel system-journal www –

回答

0

你必须确保ec2-user属于该组拥有写权限

如果目录/var/www/html由root拥有,它不会让您写入该文件夹。

首先你的ls -l/var/www/html

找出什么是组名,它的旁边有用户

然后发出此命令

sudo usermod -a -G www ec2-user 

您需要添加ec2-userwww

您登录了ec2-user,虽然你发出一个aws s3 sync命令,您需要写入允许的目录的权限,这就是为什么它失败。

此目录/var/www/html/releases/没有权限。

Could not create directory /var/www/html/releases/B1556013 <---- 

或su为root并尝试命令。

+0

我已经有usermod -a -G www ec2-user在我的CFT(我已经附上上面的日志)。因此,当我键入ec2-user组时,它显示ec2用户已经是www组的一部分{[ec2-user @ ip-10-206-32-92 html] $ groups ec2-user ec2-user:ec2 -user adm wheel wheel system-journal www}。另外,当我做ls -l对抗html文件夹时,它显示www组{{ec2-user @ ip-10-206-32-92 html] $ ls -l total 12 -rwxr-xr-x。 1 root www 258 Jun 30 15:06 error.html -rwxr-xr-x。 1 root www 334 Jun 30 15:06 index.html drwxr-sr-x。 13根www 4096 Jul 18 14:28发布} –

+0

你的问题是这样的:http://stackoverflow.com/questions/12700921/s3-moving-files-between-buckets-on-different-accounts/17162973#17162973 – unixmiah

+0

您需要为源和目标许可s3命令。在您的s3设置中,当您将用户包含在配置中时,请确保用户有权写入目录,特别是在创建文件时。 – unixmiah

相关问题