Introduction
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.
Procedure
There should be a hostname file in /var/cpanel/userdata/nobody/ and can be seen for example with
04:15:30[cp1]~ # 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
04:15:32[cp1]~ #
The setting that needs to be updated is userdirprotect.
Example with user nobody excluded.
04:17:11[cp1]~ # grep ^userdirprotect /var/cpanel/userdata/nobody/$(hostname)
userdirprotect: -1
04:17:20[cp1]~ #
and when not excluded
04:17:50[cp1]~ # grep ^userdirprotect /var/cpanel/userdata/nobody/$(hostname)
userdirprotect: ''
04:17:50[cp1]~ #
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.