Search code examples
apacheamazon-ec2permissionsebextensions

How to change permissions of /etc/httpd/conf/httpd.conf of Ec2 while copying httpd.conf from .ebextensions?


I have .ebextensions directory in the top of the war file. .ebextensions has 01movehttpd.config and httpd directory. Insider httpd is httpd.conf.

In the config file, I have

#files:
# yada yada yada
container_commands:
 00_rewrite:
  command: cp -f .ebextensions/httpd/httpd.conf /etc/httpd/conf/
  ignoreErrors: true

But whenever I deploy war file to beanstalk I don't see new httpd.conf being moved to /etc/httpd/conf/

When I checked by ssh ing to Ec2, I found out

cp: cannot remove ‘/etc/httpd/conf/httpd.conf’: Permission denied

How can I grant permissions, so that in future when I create new environment and deploy war files, I don't experience same issue.


Solution

  • Sudo!

    command: sudo cp -f .ebextensions/httpd/httpd.conf /etc/httpd/conf/