Account creation error (multiple home directories)

ronaldst

Well-Known Member
Feb 22, 2016
85
16
8
Norway
cPanel Access Level
Root Administrator
I have a dedicated with the following directory/partition setup
sda2 /home
sdb1 /home1
sdb2 /home2

In "Basic Webhost Manager Setup" I've set the location of new users to be created in /home1.

However, when creating a new account today, it was automatically stored to /home2. This is the home -directory with the most available space, so I assume my settings were not active yet. I moved the account to /home1 with the "Change Disk Partition" option.

Do I need to restart any services after changing the location of new users in "Basic Webhost Manager Setup" for the changes to be in effect?

Later I discovered that something odd had happened with the account that I moved. His webdomain shows an empty directory, even though he had uploaded his website. When investigating the issue I noticed that this user account still had his directory located in /home2 (no symlink). While in /home1 is a symlink pointing to /home2/user1.

Is there any known issues with moving accounts from one partition to another? I always had the impression user symlinks were stored in /home pointing to the proper partitions.

Looking through some of the other accounts on this server, which I believe have also been moved from /home2 to /home1, have symlinks in /home2 pointing to /home1, rather than from /home to /home1.
 

24x7server

Well-Known Member
Apr 17, 2013
1,911
96
78
India
cPanel Access Level
Root Administrator
Twitter
Hi,

Yes, incidence like this has been reported. Did the actual symlink in /home2 already existed for the account that you moved to /home2, that is the most likely case.

Check what is provided in the WHM basic setting for the home directory and then try creating a test account to see where does it get created? Can you share the output of this with us here.
 

ronaldst

Well-Known Member
Feb 22, 2016
85
16
8
Norway
cPanel Access Level
Root Administrator
In "Basic Webhost Manager Setup" I've set the location of new users to be created in /home1

Adding new account. Log bellow.

Code:
Checking input data......Done
Validating system setup......Done

...Done
Validating IP......Done
Validating Username......Done
Validating Contact Email......Done
Checking for database conflicts......Done
WWWAcct 12.6.0 (c) 2018 cPanel, Inc....

Dns Zone check is enabled.
+===================================+
| New Account Info                  |
+===================================+
| Domain: someuser1029.com
| Ip: 255.255.255.251 (n)
| HasCgi: y
| UserName: someuser1029
| PassWord: password
| CpanelMod: paper_lantern
| HomeRoot: /home2
| Quota: 2.44 GB
| NameServer1: ns7.domain.com
| NameServer2: ns8.domain.com
| NameServer3:
| NameServer4:
| Contact Email: [email protected]
| Package: Mini
| Feature List: default
| Language: en
+===================================+
...Done

Running pre creation script (/usr/local/cpanel/scripts/prewwwacct)......Done

Adding User...Removing Shell Access (n)
Success...Done

Setting up Horde database in the background....
Creating bandwidth datastore......Done


Adding Entries to userdata......Done

Updating the userdata cache......Done

Setting up Mail & Local Domains...localdomains...valiases ...vdomainaliases...vfilters......Done

Configuring DNS...Bind reconfiguring on mars using rndc
Zone someuser1029.com has been successfully added
...Done

Updating Authentication Databases......Done

Adding Entries to httpd.conf......Done

Updating user’s Apache jail filesystem......Done

Restarting apache......Done

Setting passwords......Done

Updating the dedicated IP address usage cache......Done

Verifying MX Records and Setting up Databases...Reconfiguring Mail Routing:
LOCAL MAIL EXCHANGER: This server will serve as a primary mail exchanger for someuser1029.com's mail.:
 This configuration has been manually selected.

...Done

Bind reloading on mars using rndc zone: [someuser1029.com]
...Done

Sending Account Information......Done

Running post creation scripts (/usr/local/cpanel/scripts/legacypostwwwacct, /usr/local/cpanel/scripts/postwwwacct, /usr/local/cpanel/scripts/postwwwacctuser)......Done

wwwacct creation finished
Setting up Domain Pointers......Done

Setting Reseller Privs......Done

Account Creation Complete!!!...Account Creation Ok...Done

The account was created in /home2.

Code:
[[email protected] ~]# ls -la /home | grep someuser*
[[email protected] ~]# ls -la /home1 | grep someuser*
[[email protected] ~]# ls -la /home2 | grep someuser*
drwx--x--x. 11 someuser1029 someuser1029  4096 Mar 12 11:19 someuser1029
[[email protected] ~]#
Moving the account with Rearrange an Account. Now the results are
Code:
[[email protected] ~]# ls -la /home | grep someuser*
[[email protected] ~]# ls -la /home1 | grep someuser*
drwx--x--x. 11 someuser1029 someuser1029  4096 Mar 12 11:19 someuser1029
[[email protected] ~]# ls -la /home2 | grep someuser*
lrwxrwxrwx.  1 root root    19 Mar 12 11:27 someuser1029 -> /home1/someuser1029
[[email protected] ~]#
The files are moved to the choosen homedir, and a symlink created from the initial homedir /home2 to /home1.

Is this symlink behaviour normal? The initial account creation obviously went to wrong home set. When moving the account it leaves behind a symlink in the original location /home2.

EDIT!
On further investigation I am seeing other users in /home symlinked to /home2 and back to /home1. I need to clean this up as I am seeing a fast path to disaster down the road.

Its not normal behaviour for an account to be symlinked from /home -> home2 -> home1 right?

How are the symlinks made, which arguments in 'ln' are used by WHM when rearranging accounts?
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
In "Basic Webhost Manager Setup" I've set the location of new users to be created in /home1
Hello,

You can force the use of "/home1" as part of the account creation, but only by disabling the "Additional home directories matching the following value will also be used for new home directory creations. (Leaving this value blank disables the feature.) This option only takes one value." option by entering a blank value. However, that will then require you to set this option to the "home" value again when it comes time to rearrange the account. Thus, there's currently no support to do exactly what you seeking without manually changing the settings each time you need to rearrange an account. We do have an existing feature request for this functionality at:

Set home directory for reseller

Note that it references "reseller" in the title, but the body actually notes the desire to do this for both resellers and roots (as part of a package feature). I encourage you to vote and add additional feedback to that request.

On further investigation I am seeing other users in /home symlinked to /home2 and back to /home1. I need to clean this up as I am seeing a fast path to disaster down the road.

Its not normal behaviour for an account to be symlinked from /home -> home2 -> home1 right?

How are the symlinks made, which arguments in 'ln' are used by WHM when rearranging accounts?
Symlinks are not setup as part of account creation. They are only setup from the existing home directory (e.g. /home1) to the new one (e.g. /home2) when using the Rearrange an Account option in WHM. You shouldn't see a symlink for an account in the /home directory if it was created in /home1 and rearranged to /home2.

As far as the "ln" command, here's an example of how to create a symlink manually to another location if account existed in the /home directory:

Code:
ln -s /home/username /home2/username
Thank you.
 

ronaldst

Well-Known Member
Feb 22, 2016
85
16
8
Norway
cPanel Access Level
Root Administrator
Thanks for making this more clear Michael.

I am left with one important question though. Does the symlink serve an important purpose once an account is rearranged to a new partition?

Lets take the one user I got with multiple symlinks. user123 is symlinked from /home -> home2 -> home1. Can I delete the /home -> /home2 symlink, and recreate one from /home to /home1 without encountering any issues down the line?

What about users that have rearranged from /home2 to /home1. Can the symlinks at /home2 be deleted without any issues?

I am seeing a potential disaster in case /home2 harddrive crash or corrupts, making the /home1 -users rearranged from /home2 not function properly due to missing symlinks.

Can anyone elaborate how I can best handle this? Obviously I want to remove any files/symlinks from /home2 and rely on /home and /home1 for cpanel accounts.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Hello,

The symbolic links are not required, and you can remove them or adjust them to your own preferences. The primary reason they exist is to ensure a user's scripts continue to work if they hard-coded the paths to files/images (e.g. /home/user/public_html/123.jpg).

Thank you.