• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Permission Denied - files owned by apache

DaveCampbell

New Pleskian
Hi all

Newbie question which I can't find an exact answer to.

How do I change a folder from being owned by the group apache.
Can this only be done through command line?

I tried via sftp, but still the permissions were denied.

What are the best guidelines for changing permissions?
Screen grab attached of view from Plesk File Manager.

Thanks!!
Dave
 

Attachments

  • Picture 7.png
    Picture 7.png
    17.1 KB · Views: 13
Hi Dave,

Unfortunately when a file is created by PHP (when you don't use FastCGI or CGI mode for PHP), it is owned by apache.

When you login via FTP, you are acting as user "ftpusername" which therefore doesn't have permission to delete/rename etc the files owned by apache.

So yes, you need to change the ownership via the command line in this case.

To stop this happening in the future, you need to select the PHP-FastCGI option for PHP in the hosting setup. It is more secure as well. It does consume more resources than using the normal mod_php option, however. And there are some other oddities you might encounter. For example some scripts may complain about PHP session paths, and you might want to check to make sure you change all the old files and folders that were owned by apache.apache to ftpuser.psacln as otherwise your scripts won't be able to deal with them.
 
Hi Faris

Thanks for replying!

OK - I will:
change to FastCGI.
I've logged in sftp as root but can't find the right folder,
I thought it would be:
/var/www/vhosts/yourdomain/

but no luck - any hints?
 
I didn't know you could login as root using sftp (without manually settings things up). I learn something new everyday!

Normally you'd do this using ssh rather than sftp. It is possible that when you login using sftp, what you can see is limited in some way. For example limited to /root and below. Or something? I'm afraid I'm not being very helpful - I'm guessing.

But yes, you need to get to /var/www/vhosts/domain.tld/

And you won't be able to see that unless you can access the root of the file system (/) where there would be /var and /usr and /root and /home and loads and loads of other things.

Also, if it is a very old system that's been upgraded through the years then instead of /var/www/vhosts it would be /home/httpd/vhosts.

Faris.
 
It's a new System - CentOS 6. Plesk 11. Thanks I found it with your help.
Can you tell me if I've started a bad practice. I located the folder /Wordpress/Content/Themes/ThemeName
and changed it's permission to be editable by the group. What do you think?
 
Back
Top