Master admin cannot upload to Virtual Server directories via SFTP after creation

5 posts / 0 new
Last post
#1 Fri, 11/19/2010 - 14:36
JohnnyDrama

Master admin cannot upload to Virtual Server directories via SFTP after creation

Hello everyone, I'm a Virtualmin newbie and have very limited knowledge with servers, etc.

I would like to use Virtualmin to setup various domains, sites, emails, etc but I am having trouble figuring out how to allow my Master admin to upload files via SFTP & Filezilla to them after they are created.

In the past I managed various sites via Webmin and just pointed my site to the directories I used for each but from what I gather using Virtualmin will allow me to set them up quicker along with emails for each.

Via Virtualmin I am able to easily create various Virtual Servers (SiteA.com, SiteB.com, SiteC.com etc) with their own folders, but when I try to upload website files to those directories in the /home section (via Filezilla/SFTP) I get:

"permission denied Error: Failed to retrieve directory listing"

Yes, I understand that during the creation of these I am picking a user name and password, but I'm a bit confused...the master admin cannot access and upload things to the very Virtualmin server directories they just created? I really need Filezilla/SFTP access to them via the Master admin.

I am very new to all this. Virtualmin is far less useful to me if I need to constantly login and out with different users and passwords for every single site I create. Is there some easy way to automatically give my master admin permission/access to all the new sites I create so I can drag files into them all?

Thanks in advance as this is killing me...

Fri, 11/19/2010 - 19:06
andreychek

Howdy,

Yeah, whenever you create a new Virtual Server, and create an owner for that Virtual Server, you'd want to upload files using that account (or another account you create within that Virtual Server).

Otherwise, you'd end up causing various permissions problems with the files you upload, since they'd be owned by an unrelated account. If you uploaded files using a centralized account (ie, someone with root permissions), Apache would start balking when it tried to run the files, and the actual Virtual Server owner would no longer have permissions to update the files.

If your goal is to create a whole bunch of domains, but use one user to manage them all -- you may want to look into creating all those domains as "Sub-Servers". Then, the Virtual Server owner you create with the primary domain would be able to upload files to all the Sub-Servers without causing permissions issues.

-Eric

Sat, 11/20/2010 - 03:55
Locutus

As usual, my two cents. :)

I agree with everything that Eric said!

In case that you actually did upload files to top-level domains as root and the permissions are wrong, you'd go to the shell and enter:

cd /home/domainname
chown -R domainuser:domainuser *

That will change the owner and group of all files in the respective home to the correct user.

I do that regularly, since I'm "suffering" from the same issue as you, often not wanting to login as different users all the time. :) Yes, that's basically a "Linux thing", but truly useful from a security point of view. Under Windows, one could do that too, but most of the time, web services simply run as Administrator (or rather LocalSystem) there, having access to everything.

And a hint: are you sure you meant "SFTP" when talking about FileZilla? I suppose you rather meant FTPS. Sounds similar, issa bit difference. :)

SFTP is file transfer via the SSH protocol, FTPS is FTP over an SSL-secured channel. The former can be done as root, the latter usually not (except you reconfigure ProFTPD). It is possible that FileZilla also does SFTP, but that's not usual procedure.

Sat, 11/20/2010 - 17:17
JohnnyDrama

1) Re: the FTP/SFTP issue, I'm pretty sure I'm using SFTP for everything (God it sounds bad writing that, "fzSftp started" is listed when I use Filezilla)

Could never get get ProFTPD working/configured right under Webmin. For instance whenever I click the "Start Server" button I get "Failed to start FTP server : You cannot start the server daemon when in inetd mode."

Meanwhile under Virtualmin when I try to access "FTP Directory Restrictions" I get:

"FTP directory restrictions can only be configured when the ProFTPd server is installed and in use" (I was going to just try and give another user FTP access to all my Virtualmin domains folders to resolve the permission issue discussed above)

I tried uninstalling and reinstalling ProFTPd several times to no avail.

2) That Sub-Server idea sounds like a wonderful suggestion and would probably be easier to manage. I'm going to mess around and see what I can do.

Thank you both for your help with this and my other thread. I have only been a member of this forum for a day but already feel like you've cleared up quite a bit re: Linux use and limits.

Sat, 11/20/2010 - 18:05
Locutus

ProFTPD indeed needs to run in standalone mode and not via inetd, but it's easy to change that. See Webmin -> Servers -> ProFTPD Server -> Networking Options : Server Type.

The Virtualmin (and Webmin) FTP Directory Restriction only applies to FTP, not SFTP. That's because in FTP it's a usual feature to do that. But limiting users to certain directories in SSH (which SFTP uses) is not trivial, needs fiddling and patching the SSH daemon, can result in all kinds of trouble and is therefore not really recommended. :)

Topic locked