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.

Default permissions of cpanel3-skel/public_html

Discussion in 'General Discussion' started by alexz, Jun 20, 2005.

  1. alexz

    alexz Member

    Joined:
    Jun 20, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Hi,
    Could someone please help me,
    how do I make my public_html have read and write access (777) automaticly, on account creation?
    I tried to chmod 777 my cpanel3-skel/public_html, and chown it to nobody:nobody, but still, new accounts don't have write access. public_html has 750 on account creation :(
    Is there a way to make public_html be 777 on creation?
    Thank you
     
  2. gpreston

    gpreston Well-Known Member

    Joined:
    Jan 31, 2004
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    West Chester, PA
    Uhm, you don't want public_html to be 777, ever. That's a very bad thing to do.

    750 is what the directory should be.
     
  3. rootuser

    rootuser Well-Known Member

    Joined:
    Jan 31, 2005
    Messages:
    124
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    ***INDIA***
    chmod 755 cpanel3-skel/public_html

    chown yourprimaryuser.primarygroup cpanel3-skel/public_html
    it is not as nobody in my case ......
     
  4. alexz

    alexz Member

    Joined:
    Jun 20, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    I still don't have write access :(
    Maybe I need to modify newacc creation script or something?
    And how do I know whats my yourprimaryuser.primarygroup?
    Is it the one apache and php are using?
    ps. I really do need it, and I am the only one using the server, I am not reselling it, so no security risks.
    Thank you
     
  5. gpreston

    gpreston Well-Known Member

    Joined:
    Jan 31, 2004
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    West Chester, PA
    This is how my /root/cpanel3-skel/ folder looks:

    Code:
    drwxr-xr-x   4 root root 4096 Jan 28 22:17 ./
    drwxr-x---  14 root root 4096 Jun 20 00:48 ../
    drwxr-xr-x   2 root root 4096 Jan 28 22:17 public_ftp/
    drwxr-xr-x   2 root root 4096 Jan 28 22:17 public_html/
    As you can see, the public_html folder is owned by user root, group root, and is 755 privileges.

    This is what I believe to be the default setup.

    When an account is created, for example, 'johndoe', the directory /home/johndoe should be created, owned by user johndoe, and group johndoe.

    The public_html folder should be auto-created for this person with 755 privileges and should be owned by their username and group.

    At this point, that user should be able to log in and read/write to their own public_html directory.
     
  6. alexz

    alexz Member

    Joined:
    Jun 20, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    this is what I have:

    root@host [~/cpanel3-skel]# ls -l
    total 16
    drwxr-xr-x 4 root root 4096 Jan 21 14:42 ./
    drwxr-x--- 16 root root 4096 Jun 19 21:51 ../
    drwxr-xr-x 2 root root 4096 Jan 21 14:42 public_ftp/
    drwxrwxrwx 4 root root 4096 Jun 20 02:18 public_html/

    But, when the account is created my php scripts can not create new files in public_html,
    I need to ftp there and chmod public_html то 777, and only then my scripts start to work :(
    Is there anything I can do to make it writable from the begining?
    Thank you
     
  7. alexz

    alexz Member

    Joined:
    Jun 20, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    found it myself:

    needed to modify wwwacct script, line 901

    form:

    safe_chmod(0750,$useruid,"${mnt}/${user}/public_html");

    to:

    safe_chmod(0777,$useruid,"${mnt}/${user}/public_html");

    now everything works as I wanted

    Thanks to all replyed
     
  8. gpreston

    gpreston Well-Known Member

    Joined:
    Jan 31, 2004
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    West Chester, PA
    Ah... that was a very very important detail you left out, thank you. Of course they can't write to the directory, it isn't writeable! Its only readable and executable. If you had said you were trying to write to the directory via PHP scripts, this could have been solved a lot quicker. I would not make that part of your account creation script though. That is a VERY special case when you need PHP scripts able to write to a directory. It should not ever be the de facto.
     
Loading...

Share This Page