Cron command to correct insecure file permission

moleno

Active Member
Jan 31, 2013
25
0
1
cPanel Access Level
Root Administrator
I think most of the exploit occurs due to the insecure files/folder permissions.
That's why I want to scan my server once in every 24 hours for 777 permission files /folders.
I use following commands for it-
To check & correct files permission : find /home/*/public_html -type f -perm 0777 -exec chmod 644 {} \;
To check & correct folder permission : find /home/*/public_html -type d -perm 0777 -exec chmod 755 {} \;

I want to run it automatically using cron .

Can anyone help me to write a cron command and set it as root ?
 

JeffP.

Well-Known Member
Sep 28, 2010
164
15
68
You should not run that as root. It is dangerous to do so for security reasons.
 

Infopro

Well-Known Member
May 20, 2003
17,113
507
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
We're talking about security here. You really should look into this more than waiting on a forum reply all weekend. I don't mean to sound harsh here, but security is the most important thing you need to wrap your head around when it comes to managing a server.