Question
How to manually set mod_userdir DefaultHost (nobody) so it is not excluded
Answer
You may have scripts you run to ensure certain settings are set or not and would like the DefaultHost (nobody) not to be excluded. There presently isn't an API to make this change.
There should be a hostname file in /var/cpanel/userdata/nobody/ and can be seen for example with
# ls -ald /var/cpanel/userdata/nobody/$(hostname)
-rw-r--r-- 1 root root 231 Feb 2 04:11 /var/cpanel/userdata/nobody/cp1.myserver.com
The setting that needs to be updated is userdirprotect.
Example with user nobody excluded:
# grep ^userdirprotect /var/cpanel/userdata/nobody/$(hostname)
userdirprotect: -1
When not excluded:
# grep ^userdirprotect /var/cpanel/userdata/nobody/$(hostname)
userdirprotect: ''
The following sed statements will change the line to not be excluded for user nobody:
# sed -i "s/userdirprotect\:\ \-1/userdirprotect\:\ \'\'/g" /var/cpanel/userdata/nobody/$(hostname)*
sed -i "s/DefaultHost:-1/DefaultHost:/g" /var/cpanel/moddirdomains
Afterward, httpd.conf needs to be rebuilt and Apache restarted with
# /scripts/userdirctl on
# /scripts/restartsrv_httpd --hard
Comments
0 comments
Article is closed for comments.