Virtual Server and FTP Users

16 posts / 0 new
Last post
#1 Wed, 08/31/2011 - 17:51
Regional Creations

Virtual Server and FTP Users

Hello,

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.

Wed, 08/31/2011 - 21:40
andreychek

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?

-Eric

Thu, 09/01/2011 - 08:01
Regional Creations

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...

Thu, 09/01/2011 - 10:17
andreychek

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?

-Eric

Fri, 09/02/2011 - 10:51
Regional Creations

I haven't changed any settings other than virtual server specific ones, but it still happens on new servers that are created.

Fri, 09/02/2011 - 11:06
andreychek

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?

-Eric

Fri, 09/02/2011 - 11:16
Regional Creations

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... :(

Fri, 09/02/2011 - 12:55
andreychek

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:

http://winscp.net/eng/index.php

Fri, 09/02/2011 - 13:09
Regional Creations

Woah...

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...

Fri, 09/02/2011 - 13:17
andreychek

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)?

-Eric

Fri, 09/02/2011 - 14:10
Regional Creations
Fri, 09/02/2011 - 15:52
andreychek

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?

-Eric

Fri, 09/02/2011 - 20:11
Regional Creations

PHP script execution mode Apache mod_php (run as Apache's user)

Fri, 09/02/2011 - 20:13
Regional Creations

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?

Fri, 09/02/2011 - 20:17
andreychek

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.

-Eric

Fri, 09/02/2011 - 20:19
Regional Creations

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?

Topic locked