Default permissions of cpanel3-skel/public_html

alexz

Member
Jun 20, 2005
13
0
151
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
 

rootuser

Well-Known Member
Jan 31, 2005
124
0
166
***INDIA***
chmod 755 cpanel3-skel/public_html

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

alexz

Member
Jun 20, 2005
13
0
151
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
 

gpreston

Well-Known Member
Jan 31, 2004
61
0
156
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.
 

alexz

Member
Jun 20, 2005
13
0
151
this is what I have:

[email protected] [~/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
 

alexz

Member
Jun 20, 2005
13
0
151
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
 

gpreston

Well-Known Member
Jan 31, 2004
61
0
156
West Chester, PA
alexz said:
But, when the account is created my php scripts can not create new files in public_html
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.