How to Edit Apache2.conf | Permission Denied - Amazon AWS (EC2)

13,305

Based on the communication in comments, it is visible you use account which do not have proper permissions to write in /etc

The better and more secure way to accomplish your task is:

  1. Upload the file (via ordinary user) in /var/tmp
  2. Login to the terminal
  3. Become root: sudo su -
  4. Make a backup of the original file:

    cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_original
    
  5. Copy the new file:

    cp /var/tmp/apache2.conf /etc/apache2/apache2.conf
    
  6. Restart apache

Share:
13,305

Related videos on Youtube

Arpit Mittal
Author by

Arpit Mittal

Updated on September 18, 2022

Comments

  • Arpit Mittal
    Arpit Mittal almost 2 years

    I'm trying upload the edited apache2.conf but getting File Permission Denied Error.

    Status: Starting upload of O:\Users\Circle Radius\SRPL\apache2.conf
    Command:    cd "/etc/apache2"
    Response:   New directory is: "/etc/apache2"
    Command:    put "O:\Users\Circle Radius\SRPL\apache2.conf" "apache2.conf"
    Error:  /etc/apache2/apache2.conf: open for write: permission denied
    Error:  File transfer failed
    
    • Romeo Ninov
      Romeo Ninov about 7 years
      Directories /etc and below are owned by root. Are you authenticated with root when upload the config?
    • Alok Yadav
      Alok Yadav about 7 years
      You need to be root in order to edit or move anything in /etc/ as @RomeoNinov commented above , you could try to upload that config in your home directory first and later try to move using sudo mv
    • Arpit Mittal
      Arpit Mittal about 7 years
      @RomeoNinov I'm accessing it using User - "ubuntu" is there any command which can help me grant the permission for this user so that i can update my apache2.conf directly from FTP
    • Romeo Ninov
      Romeo Ninov about 7 years
      @ArpitMittal, copy the file to /var/tmp and then via command line move it to the proper place. Do not play with permission in /etc
    • Arpit Mittal
      Arpit Mittal about 7 years
      @RomeoNinov Thank you so much for you help.. :)
  • Buddhiprakash Kumawat
    Buddhiprakash Kumawat about 4 years
    If you don't want to upper process then i suggest you that you can edit this file in nano or vi editor and can edit it. // nano /etc/apache2/apache2.conf
  • luisdev
    luisdev about 3 years
    Restart Apache using: $ sudo service apache2 restart