Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Change file permissions on all files with a certain name

Discussion in 'Security' started by felixr, Feb 2, 2015.

  1. felixr

    felixr Registered

    Joined:
    Feb 2, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi. Is there way I can change all file permissions on a certain file name easily (without doing them 1 by 1)? Eg search /home and change all files found that match "wp-config.php"

    We have a vps with 40+ wordpress installations and want to change all the wp-config.php permissions to 400.

    Thanks
     
  2. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    1,010
    Likes Received:
    87
    Trophy Points:
    78
    cPanel Access Level:
    DataCenter Provider
    Before I tell you how to do this, I'll just state that it's basically useless from a security standpoint if you want to do it with wp-config files. In most cases if you use SuPHP (which most people do) the sites user still owns the file, and a hack script can still access the file, or change its permissions back to writeable.

    Anyway, it's a simple find command, but standard caveats of root shell access apply.
    Code:
    # find /home/*/public_html/ -type f -name wp-config.php -exec chmod 400 '{}' \;
    
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,928
    Likes Received:
    1,819
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello :)

    In addition to the previous thread, if you are looking to improve overall security, check out the cPanel Security Advisor for some useful tips:

    "WHM Home » Security Center » Security Advisor

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. felixr

    felixr Registered

    Joined:
    Feb 2, 2015
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thanks for that quizknows, it worked. :)


    CpanelMichael - Thanks, but yes i've done that.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice