Here is my actual Question. In that question, Mr. Rinzwind guided me. I did the following as per the guide.

  1. Creating Dedicated User and Group.
$ sudo groupadd apache
$ sudo useradd apache -g apache -d /dev/null/ -s /sbin/nologin
  1. Modified Apache Configuration as below.
$ sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
$ sudo nano /etc/apache2/apache2.conf
    User apache
    Group apache
$ sudo /etc/init.d/apache2 restart
  1. make "data" be owned by the "CGI app user" and set it to "700" for directories and "600" for files.
$ sudo adduser serverdata
$ sudo usermod -a -G apache serverdata 
$ sudo chown -R serverdata:apache /var/myproj/data/
$ sudo find /var/myproj/data/ -type d -exec chmod 700 {} \;
$ sudo find /var/myproj/data/ -type f -exec chmod 600 {} \;
  1. Added 'www' ownership to group.
$ sudo chown -R apache:apache /var/myproj/www/
$ sudo chmod -R 775 /var/myproj/www/

After this, I wrote a cgi call to copy a file from /var/myproj/data/ to /var/myproj/www/. But It didn't work.

What I missed in this settings? Why It couldn't get copy of that file from my Data directory to www directory which are all in the same group apache.

Test.cgi located in /usr/lib/cgi-bin/ just read this file '/var/myproj/data/test.html' and copies into '/var/myproj/www/'. But that Test.cgi doesn't read anything from '/var/myproj/data/' location.

  • What was the error message? – George Udosen Aug 21 '18 at 10:21
  • I think my data directory files couldn't be read by my cgi application. – Smith Dwayne Aug 21 '18 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.