SOLVED How to change Home directory in CPanel

Ravi97

Registered
Nov 11, 2020
3
0
1
India
cPanel Access Level
Root Administrator
Hello,
I'm a newbie in this cpanel and hosting things.

Somehow my home directory visible on cpanel has been changed from /home/admin/public_html to /var/www/html.
All of my code is in /home/admin directory but now i am not able to view those files.

Learned from some previous threads, I checked the file /var/cpanel/userdata/USERNAME/DOMAIN.COM
for documentroot: /home/USERNAME/public_html .
It seems like everything is fine in that file. But still the home directory is not getting updated.

Can Someone please help me out here..?

PS: Please find attached a screenshot of my cpanel, and the highlighted new home directory.
 

Attachments

Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,290
2,234
363
cPanel Access Level
Root Administrator
Hey there! Thanks for joining the forums and talking with us!

If the data in the userdata file is correct that's a good thing. I would also recommend manually checking the Apache configuration to see if the wrong data is present there. If so, you can run the following commands to backup and rebuild the Apache configuration using the correct information from the userdata file:

Code:
cp /etc/apache2/conf/httpd.conf{,.bak-`date +%Y%m%d`}
/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd
Can you try that and let me know how it goes?
 

Ravi97

Registered
Nov 11, 2020
3
0
1
India
cPanel Access Level
Root Administrator
Thank you for your response.
I ran those commands at an escalated root level.
For first command i didn't get any noticeable response, second and third commands seamed successfull.

but the home directory in cpanel is not yet changed..
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,290
2,234
363
cPanel Access Level
Root Administrator
That's correct - the first command wouldn't have given any output.

That's interesting though, as by default cPanel creates everything in the /home/ directory. Was there any special tool used to create this account, or was this done through WHM? Is this issue only happening with one domain on the system?
 

Ravi97

Registered
Nov 11, 2020
3
0
1
India
cPanel Access Level
Root Administrator
This issue has been now resolved.

Some random youtube video had wrongly guided me to use usermod -d command with a different directory.
Being very new to this field i followed it without a second thought. But now it was resolved.

Thank you so much for your help Rex. :)