1

I am facing problems with PHP interface that calls perl and shell scripts. These enable uploading of a file to a folder and execute them with some input while storing output into some other files. Now it appears that I can either give read-write access or execute using one of the following:

chcon -Rv --type=httpd_sys_rw_content_t user_dir/
chcon -Rv --type=httpd_fastcgi_script_exec_t user_dir/

How can I enable a folder recursively to have read-write and execute permissions?

1 Answer 1

0

From what I can tell, the default selinux policy for httpd doesn't support creating executable files (no surprise there).

You have a couple of options that don't involve disabling selinux, (1) customize the default policy / create your own or (2) change httpd to run without selinux protections.

If you want to do (2), run the following:

# chcon -t unconfined_exec_t /usr/sbin/httpd 
# /etc/init.d/httpd restart 

This will cause httpd to run in the unconfined domain and will be subject only to the normal unix rwx permissions.

To restore httpd to its default targeted policy use 'restorecon' :

# restorecon -F /usr/sbin/httpd 
# /etc/init.d/httpd restart

You must log in to answer this question.

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