chmod -R user / how screwed am i?

webwizardma

Member
Feb 25, 2014
5
0
1
cPanel Access Level
Root Administrator
I accidentally ran this command AS ROOT...

/chmod -R user /

instead of

/chmod -R user ./

My hosting provider said they will setup new HDD's, and attach the old ones via USB for me to copy everything from, but the ETA for that is 5 hours.

I'm a proficient coder, so anything that you can think of I can try, any ideas for a way to get this fixed otherwise?

SSH is down, restart fails. autofixer fails. MySQL server is down. FTP, WHM/cPanel is still up.
 

robb3369

Well-Known Member
Mar 1, 2008
122
1
66
cPanel Access Level
Root Administrator
We recently had a similar issue, but down the user home path... Try this script:
Code:
#!/bin/bash
cd /var/cpanel/users
for user in *
do
	chown -R $user.$user /home/$user/
	chown $user.nobody /home/$user/public_html
	chown $user.mail /home/$user/etc
done
/scripts/chownpublichtmls
/scripts/mailperm
Again, this is specific to the home directory path, but should help a bit when moving files to new drive...
 

vanessa

Well-Known Member
PartnerNOC
Sep 26, 2006
835
28
178
Virginia Beach, VA
cPanel Access Level
DataCenter Provider
Well, if you can't SSH into the server to fix anything, you're sorta screwed. You can try going into WHM (since you said that works) and forcing a cPanel update which will trigger a series of autofixers, but the issues on the system will likely halt the update process.
 

webwizardma

Member
Feb 25, 2014
5
0
1
cPanel Access Level
Root Administrator
I did actually try that, and I also tried rebuilding Apache via EasyApache, thinking that a rebuilt would reset permissions. None of that worked. :(

I'm honestly surprised & confused why EasyApache didn't solve the problem!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
My hosting provider said they will setup new HDD's, and attach the old ones via USB for me to copy everything from, but the ETA for that is 5 hours.
This is the best option in my opinion. Install cPanel on the new hard drive, and then re-create the accounts. Ideally, you should restore the accounts from any cPanel backup archives.

Thank you.
 

robb3369

Well-Known Member
Mar 1, 2008
122
1
66
cPanel Access Level
Root Administrator
Although probably too late now, but Chirpy has a tool called CSE that gives you an virtual console into the server:
ConfigServer Explorer

Might be good to have in the future... This is one of the those "I'll never do that again" things. During interview prospects, I always ask the candidates what their best INDTA moments were, since I don't want them do it with my machines.