WeBWorK Main Forum

cannot upload files

Re: cannot upload files

by Richard Bayne -
Number of replies: 6
Arnie,
Thanks. You have cleared up the problem. I was looking at the wrong files/directories. Once I changed the directories you indicated to have the proper ownership, the troubles went away.
Thanks again.
Bayne
In reply to Richard Bayne

Re: cannot upload files

by Sukhjit Singh Sehra -

Arnie,

I am setting up webwork on RHEL 8 using tutorial https://webwork.maa.org/wiki/Installation_Manual_for_2.16_on_RHEL8.

I am facing the same issue permission denied issue while trying to upload the files:

failed to write upload info file /opt/webwork/webwork2/DATA/uploads/5E3C41DE-5935-11EC-9AC5-5BAE1AA73A45.info: Permission denied at /opt/webwork/webwork2/lib/WeBWorK/Upload.pm line 112.

The permissions for the /opt/webwork/webwork2/DATA/ are:

 0 drwxrwsr-x.  3 wwadmin apache     21 Dec  2 10:18 DATA

Where wwadmin is a standard user (added to sudoers) and apache is the server group.

Any thoughts on it


In reply to Sukhjit Singh Sehra

Re: cannot upload files

by Andras Balogh -
Have you completed the SELinux part on the manual page?
In reply to Andras Balogh

Re: cannot upload files

by Sukhjit Singh Sehra -
Yes, I did after your message I rerun those and the following is the output:
root@QWEBWORK:\ [ /home/wwadmin ]# semanage fcontext -a -t httpd_sys_content_t '/opt/webwork(/.*)?'
ValueError: File context for /opt/webwork(/.*)? already defined
root@QWEBWORK:\ [ /home/wwadmin ]# semanage fcontext -a -t httpd_sys_rw_content_t '/opt/webwork/courses(/.*)?'
ValueError: File context for /opt/webwork/courses(/.*)? already defined
root@QWEBWORK:\ [ /home/wwadmin ]# semanage fcontext -a -t httpd_sys_rw_content_t '/opt/webwork/courses(/.*)?'
ValueError: File context for /opt/webwork/courses(/.*)? already defined
root@QWEBWORK:\ [ /home/wwadmin ]# emanage fcontext -a -t httpd_sys_rw_content_t '/opt/webwork/webwork2/htdocs/tmp(/.*)?'
bash: emanage: command not found
root@QWEBWORK:\ [ /home/wwadmin ]# semanage fcontext -a -t httpd_sys_rw_content_t '/opt/w
ebwork/webwork2/htdocs/tmp(/.*)?'
ValueError: File context for /opt/webwork/webwork2/htdocs/tmp(/.*)? already defined
root@QWEBWORK:\ [ /home/wwadmin ]#
root@QWEBWORK:\ [ /home/wwadmin ]# setsebool -P httpd_can_sendmail 1
root@QWEBWORK:\ [ /home/wwadmin ]# setsebool -P httpd_can_network_connect on
root@QWEBWORK:\ [ /home/wwadmin ]# restorecon -vFR /opt
Relabeled /opt/webwork/pg/lib/chromatic/color from unconfined_u:object_r:httpd_sys_content_t:s0 to system_u:object_r:httpd_sys_content_t:s0


Also run root@QWEBWORK:\ [ /home/wwadmin ]# checkmodule -M -m -o my-ping.mod my-ping.te
root@QWEBWORK:\ [ /home/wwadmin ]# semodule_package -o my-ping.pp -m my-ping.mod
root@QWEBWORK:\ [ /home/wwadmin ]# semodule -X 300 -i my-ping.pp

Looks like it is not having issue.


Following are the permissions for a Test course: wwadmin@QWEBWORK:\ [ /opt/webwork/courses/Test ]$ ls -ls
total 8
4 -rw-rw-r--.  1 apache apache 3222 Dec  9 16:18 course.conf
0 drwxrwsr-x.  3 apache apache   23 Dec  8 11:20 DATA
0 drwxrwsr-x.  4 apache apache   40 Dec  8 11:20 html
0 drwxrwsr-x.  2 apache apache   41 Dec  9 14:35 logs
0 drwxrwsr-x.  2 apache apache    6 Dec  8 11:20 scoring
4 drwxrwsr-x. 11 apache apache 4096 Dec  9 13:36 templates

And: in wwadmin@QWEBWORK:\ [ /opt/webwork/webwork2

 0 drwxrwsr-x.  3 wwadmin apache     21 Dec  9 17:44 DATA

In reply to Sukhjit Singh Sehra

Re: cannot upload files

by Danny Glin -

Have you double-checked the permissions on /opt/webwork/webwork2/DATA/uploads?

In reply to Danny Glin

Re: cannot upload files

by Andras Balogh -

I think after disabling SeLinux it started to work for him. Not sure if there is an issue with the SeLinux part or not in the installation notes.


In reply to Andras Balogh

Re: cannot upload files

by Sukhjit Singh Sehra -

I enabled SElinux

Re-enable SElinux: 

sudo setenforce 1 

Temporarily change the context for DATA + subfolders: 

 sudo chcon -R -t httpd_sys_rw_content_t /opt/webwork/webwork2/DATA 

Test to see if the error is still resolved, and if so, make it permanent: 

sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/webwork/webwork2/DATA(/.*)?"