Help with Create_domain API

I am trying to batch create sites for student use. I want them to be able to upload basic webpages (no db) to the site via FTP but no email, no mysql etc.

Here is the script I have been playing with;
virtualmin create-domain --domain jay.mydomain.ca --unix --dir --web --quota 50000 --uquota 50000 --user jay --pass jayjay

This creates the site great, but when I ftp the new site with the user account, I see too many folders that will confuse the situation;

ftp> ls
200 PORT command successful
150 Opening ASCII mode data connection for file list
Maildir
tmp
cgi-bin
public_html
fcgi-bin
homes
virtualmin-backup
logs
etc
226 Transfer complete

How can I limit the user to only public_html and not see the other folders? They don’t need access to cgi-bin, fcgi-bin, homes,virtualmin-backup, logs, or etc. Mail isn’t setup for the account so maildir shouldn;t display either.

Maybe my script needs a bit of tweaking?

Thanks.

Also, on a side note, any way to set some default files in the directory that the students couldn’t edit or delete like a robots.txt file that contains

User-agent:*
Disallow:

Thanks.

Default files go in /etc/skel (or whatever you choose as your skel directory). Make robots.txt owned by root, writable only by owner, and readable by all so Apache can serve it.

There are several options for dumping users into public_html…you’ll probably want an additional user for this. Though it might just be worth teaching your students what those directories are and that public_html is where websites live (it’s a common practice, so they’ll see it again, most likely). There is a “Website FTP access user” type that might do the trick. It limits the user to FTP or SCP only, but could be tweaked to allow ssh, as well, probably. I don’t remember how that’s implemented. You could also just create a regular Virtualmin user with no features other than shell and set their home directory to /home/domain/public_html. Their group membership in the domain group will allow them to write to that directory (I’m pretty sure…might need to be tweaked to allow group writes).

Also you are asking on wrong forum…

I moved it to the right one.

1 Like

Thanks Joe, I looked but didn’t see where best to put it.