4

I'm having trouble running a CGI example with Shell Script, I'm not able to access the directory created in the example I'm following "/tmp/shell". By accessing the address "http://localhost/shell" should see a page "Index of shel" but gives 403 error with the message "You do not have permission to access/shell/ on this server."

I am using Fedora 24, and I think the apache user is called 'Apache', well, at least there is an apache user in the file "passwd", the folder where I wanted to run CGI files is with permission 777 and has changed the user to "apache" with chown, but still gives 403 error.

My file "/etc/httpd/conf/httpd.conf" looks like this:

$ Tail -n20 /etc/httpd/conf/httpd.conf

# Settings for the study of Shell Script and CGI

Alias ​​/shell "/tmp/shell/"

<Directory "/tmp/shell/">
    Options Indexes FollowSymlinks ExecCGI
    AllowOverride None
    Order allow, deny
    Allow from all
</ Directory>

My /tmp/shell:

$ ls -ld /tmp/ /tmp/shell
drwxrwxrwt. 15 root   root   480 Out  1 13:53 /tmp/
drwxrwxr-x.  2 apache apache  40 Out  1 13:52 /tmp/shell

Apache runs normally at http://localhost, I do not understand why I cannot access the /tmp/shell. I'm going crazy here!

Can someone help me?

1
  • already edited!
    – Patterson
    Oct 1, 2016 at 16:55

1 Answer 1

4

Fedora 24 uses systemd, and is probably setting up a private /tmp just for the httpd process. You can check for this with

sudo systemctl show -p PrivateTmp httpd

You can override this by creating a file /etc/systemd/system/httpd.service containing

.include /lib/systemd/system/httpd.service
[Service]
PrivateTmp=false

and doing sudo systemctl daemon-reload before restarting the service.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .