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.

recursive command to set permission

Discussion in 'General Discussion' started by leonep, Feb 6, 2017.

  1. leonep

    leonep Well-Known Member

    Joined:
    Nov 18, 2014
    Messages:
    63
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Pescara
    cPanel Access Level:
    Root Administrator
    Hi,
    i want to know if is secure to use the recursive commands for assign the permissions. i have read something here time ago with security problem about recursive chown

    this command can be consider safe ? i use suPhP
    the purpose is to correct all files in public_html

    for user in `ls -1 /var/cpanel/users | grep -v "\/"`; do find /home/$user/public_html/ -name "*" | sed 's/ /\\ /g' | xargs -n 1 chmod 644; find /home/$user/public_html/ -type d | sed 's/ /\\ /g' | xargs -n 1 chmod 755; find /home/$user/subdomains/ -name "*";find /home/$user/subdomains/ -type d | sed 's/ /\\ /g' | xargs -n 1 chmod 755;done


    thanks
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,281
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    It's generally advised to avoid using recursive chown or chmod commands. For instance, it's possible a user has intentionally configured the permissions on a file/directory to something other than 0755 or 0644.

    Thank you.
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    15,617
    Likes Received:
    296
    Trophy Points:
    433
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    I'm guessing you're referring to this old post:
    Switching to suPHP

    That thread is still of value I think.
     
  4. leonep

    leonep Well-Known Member

    Joined:
    Nov 18, 2014
    Messages:
    63
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Pescara
    cPanel Access Level:
    Root Administrator
    thanks is it
     
    #4 leonep, Feb 6, 2017
    Last edited: Feb 6, 2017
Loading...

Share This Page