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.

change folders and subfolders permission

Discussion in 'General Discussion' started by bickyz, Nov 4, 2009.

  1. bickyz

    bickyz Member

    Joined:
    Nov 4, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    hi,
    is there anyway via cpanel that i can change the permissions (755) of folders and the subfolders without doing one by one.

    Like parent folder permission to propagate to subfolders (child).
     
  2. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Joined:
    Apr 22, 2009
    Messages:
    228
    Likes Received:
    1
    Trophy Points:
    18
    You can change the permissions recursively if you have shell(SSH) access. Do you?
     
  3. bickyz

    bickyz Member

    Joined:
    Nov 4, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    yes i do have shell access.
     
  4. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    As a friendly word of caution, please be careful when entering commands that apply changes recursively as there is the potential (for human error or otherwise) to inadvertently set access permissions that may break expected functionality or restrict normal access, for example, by changing the permissions of the public_html directory or other higher-level (parent) directories.

    Before proceeding, I recommend carefully reading the manual "man" pages for both the utilities used, "find" and "chmod" as seen in the above example:
    Code:
    # man find
    # man chmod
    Via SSH access, the following example may help to get started (where "username" is the cPanel account username):
    Code:
    # find /home/username/public_html/customdirectory -type d -exec chmod -v 0755 '{}' \;
    To only test the command and preview what exactly would be done, the command "echo" could be inserted between "-exec" and "chmod" as seen below:
    Code:
    # find /home/username/public_html/customdirectory -type d -exec echo chmod -v 0755 '{}' \;
     
  5. thewebhostingdi

    thewebhostingdi Well-Known Member

    Joined:
    Jan 10, 2008
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    16
    To change the permission to 755 recursively, you will have to type below mentioned command through SSH:

    chmod -R 755 foldername

    Firing the above command it will automatically change the permission to 755 of the foldername and the subfolders inside the foldename.
     
  6. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Joined:
    Apr 22, 2009
    Messages:
    228
    Likes Received:
    1
    Trophy Points:
    18
    That would change the permissions of the files within the directory as well. Instead if you want to change just the directory permissions then use the following command :

    Code:
    find ./* -type d | xargs chmod 755
     
  7. linux7802

    linux7802 Well-Known Member

    Joined:
    Dec 14, 2007
    Messages:
    232
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Solution

    Basically as per your query it seems to be that you want to change the permission 755 for files/directories present under the subfolder present under the main directory (public_html).Than refer the following command.

    chmod 755 /home/user/public_html/subfolder -R

    The above command will change the all files/folders permission present under the directory /home/user/public_html/subfolder

    And if you want to change the permission 755 to only directory present under the /home/user/public_html/subfolder then use following command

    On shell
    And if you want to change the permission 755 to only files present under the /home/user/public_html/subfolder then use following command

    On shell
     
Loading...

Share This Page