whm-expert

Active Member
Nov 10, 2012
40
0
6
cPanel Access Level
DataCenter Provider
Hello All

i want to immutable "www" directory for a website in my server except "www/ar/upload" so no one can change the file from FTP,or file manger in cpanel
so if

i "chattr -R +i /home/User/www"

then i

"chattr -R -i /home/User/www/ar/upload"

could the user still upload file to "upload" directory?and is this the right way to do it?

Best regards
 

ThinIce

Well-Known Member
Apr 27, 2006
352
9
168
Disillusioned in England
cPanel Access Level
Root Administrator
hrm, you might want to try this on the public_html directory rather than with www (which I think will be a symlink in a cPanel environment by default) I've got a feeling there is an additional flag necessary if you want chattr to follow links, although if that's your problem I'm surprised it isn't throwing an error
 

quizknows

Well-Known Member
Oct 20, 2009
1,008
86
78
cPanel Access Level
DataCenter Provider
You probably cannot do this this way. If the parent directory is immutable, none of it's contents can be changed regardless of attributes. For example if public_html (www) is immutable, you could not make any changes to public_html/upload/ at all because upload is inside of an immutable directory. Instead, you'd have to cd into public_html, and make everything immutable except upload, but then a user could probably make a new folder in public_html.