Portal Home > Knowledgebase > Articles Database > Help CHMOD
Help CHMOD
Posted by antoniojeldres, 12-17-2008, 01:49 PM |
Help CHMOD
Hey guys,
A cpanel update screwed up my CHMOD in my server, all public_html for my customer are set to 750, I've being doing the change manually to 755 and I would like to know if there is any command that I can use to do all at once.
Thank you in advance.
Ps. I have 300 accounts in that server.
|
Posted by jaseeey, 12-17-2008, 01:53 PM |
Is it just the public_html folder? or all of the contents within the folders too?
|
Posted by antoniojeldres, 12-17-2008, 01:56 PM |
only public_html
I only need to chmod 755 to every public_html in home
|
Posted by jaseeey, 12-17-2008, 01:59 PM |
So you do not want to modify the permissions of any contents within the public_html folder? If so, create a new file and execute it containing this.
Code:
#!/bin/bash
# chownfixer2 - Ultimate tool for setting proper CHOWN values
# Created by Harzem @ WHT
x=0
cd /var/cpanel/users
for user in *
do
echo "Working on account $user"
chmod 755 /home/$user/public_html
echo "Account $user is finished"
x=$(($x + 1))
done
echo "$x accounts are processed by CHMOD"
cd ~
# version 1.0
# DEV_DATE: August 9th, 2007
Last edited by Jaseeey : 12-17-2008 at 01:05 PM.
|
Posted by jaseeey, 12-17-2008, 02:06 PM |
Sorry mate, may have caused an error there.
I modified a script to do what you want.
If you have already ran it before the edit, tell me and I will reverse it for you.
|
Posted by antoniojeldres, 12-17-2008, 02:11 PM |
I didn't run it yet.
Did you change it?
Can you post again the final script?
Thank you.
|
Posted by jaseeey, 12-17-2008, 02:15 PM |
The final script is pasted below. This should change the permissions back to 755 of the public_html directory only - NOT the contents within it. It will pretty much go through every user on your cPanel server and adjust the permissions accordingly. I have given it a test on mine, because I just noticed I had the same issue, and it all set it fine.
Code:
#!/bin/bash
# chownfixer2 - Ultimate tool for setting proper CHOWN values
# Created by Harzem @ WHT
x=0
cd /var/cpanel/users
for user in *
do
echo "Working on account $user"
chmod 755 /home/$user/public_html
echo "Account $user is finished"
x=$(($x + 1))
done
echo "$x accounts are processed by CHMOD"
cd ~
# version 1.0
# DEV_DATE: August 9th, 2007
P.S. Ignore the comments in the script. I just left them there in respects to the original script owner.
|
Posted by Jonathan Kinney, 12-17-2008, 03:44 PM |
Or you could do something simple like this:
chmod 755 /home/*/public_html
__________________
Jonathan Kinney
Data Systems Specialist
Advantagecom Networks, Inc.http://www.simplywebhosting.com
|
Posted by antoniojeldres, 12-17-2008, 03:50 PM |
Thank you guys!
I have another problem with the server, it looks like the cpanel update also screwed mysql, it went down and when I tried to start it didn't work, ERROR, I fixed adding a few lines to the my.cnf:
socket=/var/lib/mysql/mysql.sock
skip-networking
skip-innodb
It did work but now after 30 minutes it went down again, now I'm clueless about the problem.
Any idea?
Thank you.
|
Posted by Jonathan Kinney, 12-17-2008, 03:59 PM |
Well, one thing to note, that command runs into issues when the expanded wildcard results in too much data, in that case, you should use the "for X in a b c;do something;done" format like in the script. The script does count for you too, and that is fun. To reduce the amount of memory resulting in the expanded wildcard, you can cd to /home and then just run "chmod 755 */public_html" and that would potentially work if the first command using the full path resulted in an "Argument list too long" error.
__________________
Jonathan Kinney
Data Systems Specialist
Advantagecom Networks, Inc.http://www.simplywebhosting.com
|
Posted by Jonathan Kinney, 12-17-2008, 04:02 PM |
Ok, new topic. I guess my first question is, what do you mean when you say went down? Is the hardware unresponsive? Is a website not accessible? or do you mean something else?
What ever the case, I would start by looking in the logs. Depending on what you mean by going down, I would suggest a different set of logs.
__________________
Jonathan Kinney
Data Systems Specialist
Advantagecom Networks, Inc.http://www.simplywebhosting.com
|
Posted by antoniojeldres, 12-17-2008, 05:05 PM |
mysql went down, I checked the logs and i found this on the server:
081217 17:01:55 mysqld started
081217 17:01:55 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'user' is marked as crashed and should be repaired
081217 17:01:55 mysqld ended
Also it seems that the server is deleting the file mysql.sock /var/lib/mysql) and also the same file (/tmp)
Any help will be appreciated
Antonio.
|
Posted by Dynash, 12-17-2008, 06:01 PM |
https://my.alwayswebhosting.com/supp...kbarticleid=13
__________________
-Stephen JavaKrypt.com | ChangeThisWorld!
|
Add to Favourites Print this Article
Also Read