batch create users inside their own subfolders

2 posts / 0 new
Last post
#1 Sat, 08/19/2017 - 08:10
pixeline

batch create users inside their own subfolders

Hello! I work at a small (and free!) web coding school in Belgium (BeCode). We would like to provide a hosting server for our students, so that they can publish their assignments in an environment we control (otherwise they use crappy free hosting services). We have an AWS instance. I tested ispconfig and then virtualmin and I really like virtualmin much more, mainly because it allows to batch create users.

Now, i'm looking for a way to do this:

batch create users so that they can each 1. have their own subfolder under our "students.school.org" instance. So for instance, student "john doe" would be able to manage everything inside students.becode.org/johndoe/ via FTP but nothing above his folder. 2. have access to either their own mysql database (automatically created) or to a "students" database which they can only manipulate their own tables (prefixed i guess, with their username)

I got almost there (batch create users functionality meets requirement 2), but it creates a subserver (subdomain) which is inconvenient and does not meet requirement 1. Is there a way to meet both requirements with virtualmin?

Thank you very much,

Alexandre.

Sat, 08/19/2017 - 11:39
Joe
Joe's picture

Can you give them their own subdomain? e.g.: johndoe.students.becode.org

If so, you can just give each user their own entire virtual server. e.g. create a whole new Virtual Server, with just Website and home directory, and DNS. I can't remember if Virtualmin knows how to do a subdomain for a whole new Virtual Server within an existing zone...I know it can for sub-servers, but it might have to create new zones for each domain, which isn't a big deal (it should Just Work, because your glue records are already pointing to the right place, if Virtualmin is handling DNS for students.becode.org).

Even if not, you can't use sub-servers, because sub-servers are about ownership; a sub-server is owned/managed by the parent server...it isn't a new account (that's the point). If you want a new account, it has to be a new top-level virtual server.

If the users don't need Virtualmin access, and just need to be able to upload content to their home directories, you could turn on the UserDir feature in Apache, but that doesn't make it easy to allow execution of web applications. Without jumping through a lot of hoops, all applications would have to execute with the same permissions as the owner of the domain (which would mean users could see each other's content, and if they were to get clever could even potentially modify it).

Finally, even if they really must be located on a subdirectory, rather than their own domain name, you could still give each student their own virtual server and, create a ProxyPass rule in your students.becode.org VirtualHost to proxy to the student websites. e.g. proxying students.becode.org/johndoe to johndoe.students.becode.org, or some private domain just for this purpose, on the backend.

But, the simplest is to just give each student their own domain.

--

Check out the forum guidelines!

Topic locked