Submitted by amityweb on Mon, 08/27/2012 - 08:56
Just to let you know... when I use virtualmin create-domain on the command line, the public_html folder does not get created with the correct permissions or owner all the time... twice it had two different results..
First time, the group was set to nobody, so I had permission denied for the new website, and second there was no owner assigned to it, and the group was an ID rather than a name.
Both times I manually chown and chgrp but think it may be an issue to investigate.
Oh, one thing, the "virtualmin create-domain" command was called via a SSH connection from another server in a bash script... that ssh login would have been root, then it would have called the "virtualmin create-domain". Dont know if its related.
Thanks
Status:
Active
Comments
Submitted by andreychek on Mon, 08/27/2012 - 10:13 Comment #1
Howdy -- thanks for your report!
The domain(s) that you were creating, where they top-level Virtual Servers? Or were they Sub-Servers?
Submitted by amityweb on Mon, 08/27/2012 - 11:43 Comment #2
Yes top level
Submitted by andreychek on Mon, 08/27/2012 - 11:56 Comment #3
Hmm, I don't seem to be able to reproduce that... when I use create-domain on my test system here, the directories within that account are created with the correct user and group ownership.
Is there any chance we could take a look at your script that's creating those domains?
I'm curious if there's anything that it's doing differently from the test I tried that might be triggering the problem you're describing.
Submitted by amityweb on Mon, 08/27/2012 - 13:34 Comment #4
My office server holds this bash script and then connects to the destimation server to create the Virtualmin server, then connects to the source to move files and databases across.
Basically I want to move non-Virtualmin accounts into Virtualmin and this saves me a LOT of time fussing with manually transferring data and databases. I run the script, then when its done all I need to do is update config files (my next step is automate the updating of common config files, but probably wont bother with that).
set -e
New Site Settingssite_domain="domainname.co.uk"
Source Server Detailssource_server="myhostserver.co.uk" source_username="accountname" source_db="account_website"
Destination Server Detailsdest_server="mydestserver.co.uk" dest_username="domainname" dest_db="domainname" dest_pass="123456789" dest_desc="Site Description" dest_sqlpass="987654321"
# CREATE DOMAIN #ssh root@"$dest_server" "virtualmin create-domain --domain $site_domain --pass $dest_pass --desc '$dest_desc' --unix --dir --webmin --web --mail --mysql --limits-from-plan --mysql-pass '$dest_sqlpass' --fwdto 'info@mywebsite.co.uk'"
# COPY FILES #ssh root@"$source_server" "rsync -avz -e ssh --progress /home/$source_username/public_html/ root@$dest_server:/home/$dest_username/public_html/"
# DUMP DB #ssh root@"$source_server" "mysqldump $source_db > /home/$source_username/$source_db.sql"
# COPY DB FILES #ssh root@"$source_server" "scp /home/$source_username/$source_db.sql root@$dest_server:/home/$dest_username/$dest_username.sql"
# RESTORE DB FILES #ssh root@"$dest_server" "mysql $dest_db < /home/$dest_username/$dest_username.sql"
Submitted by amityweb on Mon, 08/27/2012 - 13:34 Comment #5
Oh you got markdown going on or something, its changed my script, maybe you can still make sense
Submitted by amityweb on Mon, 08/27/2012 - 13:36 Comment #6
The rsync wouldn't change the parent directory would it? Just occured to me. I put a slash after it assuming it will rsync everything inside
Submitted by andreychek on Mon, 08/27/2012 - 13:54 Comment #7
The rsync wouldn't change the parent directory would it? Just occured to me. I put a slash after it assuming it will rsync everything inside
In theory, Virtualmin should be treating all the files and directories within your homedir the same way.
So if one dir is wrong, they should all be wrong.
With that thought in mind -- as I read through your script, what you mentioned about rsync is the first thought that popped into my head, that the rsync may be changing the user/group permissions of the public_html folder.
One option would be to try performing the rsync as the user who owns the files... but then you'd need to use a password or have an SSH key setup for each of them.
Another option would be to add a chown to your script after the rsync runs, so that it automatically performs a chown afterwards.
Submitted by amityweb on Mon, 08/27/2012 - 14:13 Comment #8
Yes I was going to add a chown and chgrp anyway, the owner was not always the same as the virtualmin one (but sometimes was, weird).
I will also remove rsync as a test next time I do it, and manually run it after, see if it changes. I did not think of that when raising this issue sorry, should have done that first.
Submitted by amityweb on Mon, 08/27/2012 - 14:15 Comment #9
One thing... would be great if virtualmin had something like this built in! i.e. create a new server by pulling in files and databases from elsewhere! I know you have the CPanel import but I didnt want to do that, just bring in files and databases only. I read online some people had issues with cpanel imports and didnt want to risk it hence this basic script.
Submitted by JamieCameron on Mon, 08/27/2012 - 15:19 Comment #10
Virtualmin actually has an "import" feature already, which can be used if you have already manually created a user and maybe a DNS domain and Apache website. You can find it at Add Servers -> Import Virtual Server.
Submitted by amityweb on Mon, 08/27/2012 - 17:42 Comment #11
But thats if its on the same server isnt it? I am moving sites from another server.