The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cron command to correct insecure file permission

Discussion in 'Security' started by moleno, Feb 7, 2013.

  1. moleno

    moleno Active Member

    Joined:
    Jan 31, 2013
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    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 ?
     
  2. JeffP.

    JeffP. Well-Known Member

    Joined:
    Sep 28, 2010
    Messages:
    164
    Likes Received:
    9
    Trophy Points:
    18
    You should not run that as root. It is dangerous to do so for security reasons.
     
  3. moleno

    moleno Active Member

    Joined:
    Jan 31, 2013
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thanks for reply.

    Is there any other way ?
     
  4. moleno

    moleno Active Member

    Joined:
    Jan 31, 2013
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Could any one help me on this ?

    1) should I use these two commands ?

    2) If yes, how can I use it through cron ?
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,472
    Likes Received:
    201
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Are you using SuPHP on this server?
     
  6. niceboy

    niceboy Active Member

    Joined:
    Sep 29, 2011
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    I too want to know what security threat it creates, if I run a find cron thru root?
     
  7. moleno

    moleno Active Member

    Joined:
    Jan 31, 2013
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Yes, I am using SuPHP on server.
     
  8. moleno

    moleno Active Member

    Joined:
    Jan 31, 2013
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    anyone there ??
     
  9. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,472
    Likes Received:
    201
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Weekends...


    Things don't work when files and folders are 777, with SuPHP.
     
  10. moleno

    moleno Active Member

    Joined:
    Jan 31, 2013
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thanks Infopro !

    So it mean , it's not required to run these commands in case of SuPHP.
     
  11. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,472
    Likes Received:
    201
    Trophy Points:
    63
    Location:
    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.
     
Loading...

Share This Page