Correct method to change domain account's /home/username path to existing username ?

eva2000

Well-Known Member
Aug 14, 2001
345
18
318
Brisbane, Australia
cPanel Access Level
Root Administrator
Twitter
Not sure what is the correct method of doing this so any help would be appreciated.

2 domains
  • domain.com with /home/domcom
  • domain.net with /home/domnet

now both sites have different set of files in them, but want to change domain.com to using /home/domnet path files. Changing username via modify account won't help as it says domnet already exists.

Any what's correct method to do this ?
 

aapkapratik

Member
Oct 26, 2009
24
0
51
Re: Correct method to change domain account's /home/username path to existing usernam

Hello,


If you just wish to show the data at /home/domnet when accessed http://www.domain.com/ through webbrowser and vice versa , just interchange the DocumentRoot for both domains in
"/etc/httpd/conf/httpd.conf"
eg :
Originally

<VirtualHost **.**.**.**:80>
ServerName domain.com
DocumentRoot /home/domcom

Change It To

<VirtualHost **.**.**.**:80>
ServerName domain.com
DocumentRoot /home/domnet
Same should be done for "domain.net" change its DocumentRoot to "/home/domcom".

Note : Here we have just asked apache server to pick the files from the new location when the URL is requested, so the username and password as well as access rights for both users account will remain the same, as ideally user domcom will not be having access to "/home/domnet"

If you want to avoid this and do hardship once rather then keep remembering such settings in future.I'll suggest you to please change one of your account's username to any dummy username via
modify account in WHM

Suppose if we change the username of account "domain.com" to test.

Now generate full backup of both the accounts.

For this Login to the server via SSH with root privileges and use the script

# /scripts/pkgacct test --force
&
# /scripts/pkgacct domnet --force
This will generate the backup of both accounts in tar.gz formate.

Now Terminate the account "domain.com" from "Terminate an Account" in WHM.

Once done first change the username of the account "domain.net" to domcom.

Now restore the account "domain.com" using the script
# /scripts/restorepkg test
Remember we've changed the username of this account to test.

Now "domain.com" will be having username test, change it to domnet and you are done.
 

eva2000

Well-Known Member
Aug 14, 2001
345
18
318
Brisbane, Australia
cPanel Access Level
Root Administrator
Twitter
Re: Correct method to change domain account's /home/username path to existing usernam

Thanks for that forgot about pkgacct feature. Sites are >30GB in size so could take a while.

I was also thinking, couldn't you just change the account's primary domain name ?

so domain.net modify a/c change primary domain name to domain.com ? would need to change domain.com primary domain name to something other than domain.com right ?
 
Last edited:

JawadArshad

Well-Known Member
PartnerNOC
Apr 8, 2008
459
7
68
PK
cPanel Access Level
DataCenter Provider
Re: Correct method to change domain account's /home/username path to existing usernam

Yes, renaming domnet account's main domain is the better option. Changing VirtualHosts will not last a single upcp and may cause Apache uid/gid mismatch error if not handled properly.
I would suggest you first rename domain.com to a temporary name like domain_bkp.com and then rename domain.net to domain.com as cPanel does not allow renaming a domain name if it already exists under another account for obvious reasons.

Thanks for that forgot about pkgacct feature. Sites are >30GB in size so could take a while.

I was also thinking, couldn't you just change the account's primary domain name ?

so domain.net modify a/c change primary domain name to domain.com ? would need to change domain.com primary domain name to something other than domain.com right ?