forumfish

Member
Nov 13, 2011
7
0
51
cPanel Access Level
Root Administrator
Hello, I've had this question before (https://forums.cpanel.net/f5/possible-have-domain-point-1-directory-cpanel-another-243291.html) and have learned to make the edits manually for what I needed.

I am however running into an issue now where the /var/cpanel/userdata/USER/DOMAIN.com is changing the user: field on previously modified files.

I.e.

documentroot: /home/CORE-DIR/public_html
user: CORE-DIR <--- changes back to OWNER of that cpanel account

My issue is now when I run the httpd restart it will crash those previously working sites due to user not having access to CORE-DIR.

My Question:

Is there a simple batch file I can write that will scan /var/cpanel/userdata/* for all files that contain "documentroot: /home/CORE-DIR/public_html" and change the "user:" from OWNER -> CORE-DIR.

Thank you.

NOTE: I am using SSH to make all changes to files BUT am using WHM to create the accounts, which could be causing the conflict I am having. If there is an easier way to create cpanel accounts inside SSH that will not change previously modified "user:" fields, please let me know.
 

KostonConsulting

Well-Known Member
Verifed Vendor
Jun 17, 2010
255
1
68
San Francisco, CA
cPanel Access Level
Root Administrator
How does that help the OP change the document root though?

I believe that charsleysa was responding in reference to this original item:

NOTE: I am using SSH to make all changes to files BUT am using WHM to create the accounts, which could be causing the conflict I am having. If there is an easier way to create cpanel accounts inside SSH that will not change previously modified "user:" fields, please let me know.
Unfortunately, the reality is that the original post is unclear. If you've already edited /var/cpanel/userdata/$user, that means that an account has been previously created so creating one will not work as it will error on duplicate information. If you've created a set of /var/cpanel/userdata/$user files before an account is created, that will not work as well.

At current, cPanel is designed to use $home/public_html for the document root on all new accounts. You can change the value of $home in WHM by setting the home directory prefix but there's no official method to set the document root on a per account basis.

This does sound like a valuable feature and I'd recommend forumfish to submit a feature request for this feature so that in the future, they do not have to attempt a workaround.
 
Last edited:

forumfish

Member
Nov 13, 2011
7
0
51
cPanel Access Level
Root Administrator
Thank you for your responses.

Koston is current. The accounts were created already, I edited the document root inside /var/cpanel/userdata/$user to reflect $home of Reseller account.

My goal with this entire project was to create individual cpanel accounts for users to modify their own email information, but keep the websites created for them in the root directory of the reseller account.

I will see about putting in a feature request.
 

KostonConsulting

Well-Known Member
Verifed Vendor
Jun 17, 2010
255
1
68
San Francisco, CA
cPanel Access Level
Root Administrator
My goal with this entire project was to create individual cpanel accounts for users to modify their own email information, but keep the websites created for them in the root directory of the reseller account.

I will see about putting in a feature request.
Have you used the webmail interface on port 2096? When going to https://domain.com:2096, users can manage their individual email account with the following features:

Read Webmail
Change Password
Forward Mail
Create/Edit/Delete Auto-Responders
Setup Mail Client
BoxTrapper
Email Filtering
Email Trace
 

Brian

Well-Known Member
Dec 1, 2010
117
3
68
Texas
cPanel Access Level
Root Administrator
...create individual cpanel accounts for users to modify their own email information, but keep the websites created for them in the root directory of the reseller account.
You're going to run into a whole host of problems with trying to set a DocumentRoot for a cPanel account to a location within a different cPanel user's account. First and foremost, there's the simple fact of user/group ownership and filesystem permissions on all of the content (which is unrelated to cPanel and simply a native Linux OS design concern for you to consider). Beyond that, cPanel & WHM is not designed with "cross-linking" accounts (for lack of a better term) in mind and you'll likely run into a plethora of problems stemming back to filesystem ownership issues. I would strongly advise against pursuing such an unsupported setup.

Your best bet is to utilize "Addon Domains" within the primary cPanel user (so that everything remains under the same cPanel user) and then using the custom FTP account to allow the user to upload/manage their site content. Of course, though, there isn't a means to give them limited access to Email creation/Database creation/etc. There isn't a current cPanel & WHM feature that satisfies that portion of your needs.

But, there is a feature request already submit that would cover this. I'd advise you post your support for it in its thread:
http://forums.cpanel.net/f145/multiple-cpanel-logins-cpanel-subusers-case-44353-a-77145.html

If you're a knowledgeable programmer or are willing to hire one, it would always be possible for you to take advantage of the cPanel & WHM API to create a simple web interface that allowed your clients to manage their email creation/deletion. It all depends on if this is something you're looking for *immediately* or if you're willing to wait on the feature request.