Change permissions via PHP is possible?

srh124

Member
Sep 11, 2014
5
0
1
cPanel Access Level
Website Owner
Hi all.
My question - though a beginner question- is simple. Is it possible to change permission via PHP code - or any other PL- ?

More Info: I have a wordpress site in a shared host. A hacker was using my site for sending mass spam emails, and host provider suspended my account (changed some folder permission to 000). Although i removed infected files, i couldn't find backdoor created by hacker. Now, i got to the point of restoring a healthy backup of 1 month ago. Also, i wanna change permission of nearly all folders to only readable/excutable (555). Does it prevents hacker from uploading new files /injecting malicious codes or it is still available via PHP coding?

Thanks in advance
(and sorry for bad english. I'm in emergency state now to keep my site alive)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,211
363
Hello :)

Changing permissions will not always address a vulnerability with a script. Is the script updated to the latest version? Is it a custom PHP script or a CMS such as WordPress?

Thank you.
 

srh124

Member
Sep 11, 2014
5
0
1
cPanel Access Level
Website Owner
Yes. it is wordpress with lastest version. I wanted to restrict folders which not changing frequently and hence preventing hackers from uploading new files /injecting malicious codes into those folder. If he still can change permissions via PHP code (in other unrestricted folders), so changing permissions to 555 in cPanel is useless.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,211
363
Do you have root access to this server? If not, please report the issue to your web hosting provider, as typically this needs to be addressed by someone with root access.

Thank you.