I found how to set a virtual apache server to run as the domain owner’s user. For example, on one of my domains, porthuronnow.com I have apache running as porthuronnow.
What I can’t figure out is why files uploaded via FTP with this same user have the owner 1010 and the group 1006. It’s similar for all my other servers. It doesn’t make sense to me since those aren’t even a user or group on my server.
I want files uploaded with the porthuronnow user to be owned by porthuronnow so that the apache server running as porthuronnow has full access to them.
How can I do this?
Thanks in advance.
Hmm, that sounds unusual… a user shouldn’t have the ability to create files as another user, only root can do that.
You said you’re seeing that same issue with multiple domains – is the file always using the owner 1010, regardless of what FTP user is uploading the file?
That’s just an example… another virtual server has the files owned by 1006 and the group as 1004. I have no problem writing the files with FTP the only issue is that I want the server to own the files too…
Hrm, I’m not even sure where to start, I’ve never heard of anything like that happening before
You had mentioned this above:
I found how to set a virtual apache server to run as the domain owner's user. For example, on one of my domains, porthuronnow.com I have apache running as porthuronnow.
What you’re describing there is the default on Virtualmin… after performing an install using the install.sh script, Virtualmin would setup Apache to use the FCGID execution mode, as well as configuring it to run everything as your Virtual Server owner.
I suppose my question is, what changes had you made when you configured your system to do all that? Do you know if you made any changes to ProFTPd, or to anything outside of Apache?
I haven’t changed any settings other than virtual server specific ones, but it still happens on new servers that are created.
Out of curiosity, what distribution/version are you using?
Also, just to rule this out as a possible culprit, do you have a different FTP client you could try?
Here’s the info on my server:
OS: Debian Linux 6.0
Virtualmin version: 3.87.gpl GPL
Webmin version: 1.560
I use filezilla, just tried fireFTP and same thing. I have about 100 sites saved in my FTP client and this only happens on my virtualmin server…
Well, there’s something unusual going on with your setup there, it’s just a matter of determining what that is.
What about if you log in as that user over SSH, and create/upload files… do you run into the same issue?
For example, the WinSCP client allows you to connect via SFTP. You can download that here:
This is interesting!
When I log in with FTP I see the numbers as the user / group.
When I log in with SFTP I see porthuronnow as the user and group. That’s strange.
Either way… the issue I’m trying to resolve is when I try to install a WordPress plugin from WordPress’s dashboard, it asks for the FTP info, which means it doesn’t have write access.
If the server is running as the same user as the file owner, this won’t happen…
You may want to make a test script to see if it’s indeed running as expected…
Try creating a file in your public_html folder named “test.php”, and put the following in it:
<?php phpinfo(); ?>
Then call that script from your browser. When you do that – what is “Server API” set to (that option is near the top of the page)?
According to that, it’s using mod_php, which would run as the Apache user.
If you look in Server Configuration -> Website Options, what is the PHP Execution Mode set to?
PHP script execution mode Apache mod_php (run as Apache’s user)
Well I just changed that setting to CGI wrapper (run as virtual server owner) and now I can install WordPress plugins fine. Is that how it’s supposed to be set?
I would recommend using FCGID or CGI, which are both able to run as the Virtual Server owner.
Using FCGID is the Virtualmin default. Both FCGID and CGI are okay to use.
Ok great. Thanks so much!
I’m not sure why they are all set to mod_php by default. I’ll have to have a look at my server template I guess. What can I put in the template to make that the default for new servers?