Can't delete Drupal "sites" directory/subfolders/files

thoughtcat

Member
Nov 9, 2014
7
0
1
cPanel Access Level
Root Administrator
I have lots of old Drupal sites I don't use anymore and am trying to get rid of them all. They're set up as subdomains created in cPanel, so for instance public_html/site1 and public_html/site2 etc. Via FTP I can delete all the contents of these directories except for the /sites directory and all the subfolders and files inside it, where I get "permission denied". Trying to change the file permissions on /sites and its subfolders doesn't work. Can I delete these directories through cPanel somewhere?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Hello :)

The files likely have ownership set to "nobody" if you are using DSO as your PHP handler. You should access your system via SSH as "root" and update the ownership on those subdirectories and file beneath them to the account username. Or, you could just delete the files/directories via SSH as "root".

Thank you.
 

thoughtcat

Member
Nov 9, 2014
7
0
1
cPanel Access Level
Root Administrator
Hello :)

The files likely have ownership set to "nobody" if you are using DSO as your PHP handler. You should access your system via SSH as "root" and update the ownership on those subdirectories and file beneath them to the account username. Or, you could just delete the files/directories via SSH as "root".

Thank you.
Thanks, I'm not sure how to access my system via SSH, but I ended up asking my hosting company to help out and they sorted it, probably doing what you suggested.
 

thoughtcat

Member
Nov 9, 2014
7
0
1
cPanel Access Level
Root Administrator
Hi again, actually I have now worked out how to access via SSH (via /http://www.inmotionhosting.com/support/website/ssh/how-to-login-ssh) but it's proving difficult to
update the ownership on those subdirectories and file beneath them to the account username
. If I log in as "root" as suggested I can't see how to navigate to the particular account I want. If I log in using the username and password of the actual account I can access the directories but trying to change the ownership gives "operation not permitted" errors. I am referring to this Drupal files page for info: /https://www.drupal.org/node/394704
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Your hosting provider will need to complete this for you if you do not have root access to the server. Otherwise, with root, you can simply browse to the account with a command such as:

cd /home/$username/

Thank you.
 

thoughtcat

Member
Nov 9, 2014
7
0
1
cPanel Access Level
Root Administrator
Thanks so much :) I knew it was something simple like that ;) Did this and was able to finally change the ownership of my files folder and now all is good. Cheers!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
I am happy to see the issue is now resolved. Thank you for updating us with the outcome.