Clone Virtual Server - Admin has no privileges on database

I created a clone to one of my test virtual servers then I tried to use phpmyadmin to access its database. I couldn't, user doesn't have permissions for its own database. I checked its privileges inside mysql and I discovered I should create new ones. Once I granted privileges I could use phpmyadmin to see database content. Please do a test and see what is happening.

Status: 
Active

Comments

Was this a sub-server being cloned, or a top-level virtual server?

It is a top level virtual server. I am investigating today if the privileges for initial virtual server are setup from the very beginning. If they are it means by cloning process the new admin doesn't have permissions setup for its cloned databases.

A first observation related to phpMyAdmin configuration. If you selected when installing the script in 'Database to manage' section [*] Only selected ... this selection of databases will be cloned too into the new virtual server. When you log into phpMyAdmin on cloned server you will see no databases and no privileges will be displayed. In order to correct this you have to edit

/phpmyadmin/config.inc.php
$cfg['Servers'][$i]['only_db'] = Array('your_initial_databases_list');

Also if you check Details for installed script into cloned virtual server you will see the line "initial login" having the same connection information from master virtual server.

In my opinion some scripts must be reinstalled from scratch instead of cloning them. Virtualmin is not doing anything for preventing this for the moment.

one more observation after using grep command in cloned folder looking for master name. file /home/[cloned_virtual_server]/public/awstats/.htaccess has this content:

AuthName "[master_virtual_server] statistics"
AuthType Basic
AuthUserFile /home/[master_virtual_server]/.awstats-htpasswd
require valid-user

In conclusion a few files must be edited after cloning a virtual server. Till no there are affected AWstats and phpMyAdmin. It could be other scripts too. I will evaluate RoundCube.

WARNING - OWNER PERMISSIONS IN CLONING A VIRTUAL SERVER

Just use this command find /home/[your_cloned_server] -group [master_server_name]

I found this list of files which don't have the owner and group correctly set up:

/home/[your_cloned_server]/public_html/awstatsicons
/home/[your_cloned_server]/public_html/icon/mime/csv.png
/home/[your_cloned_server]/public_html/icon/mime/dtd.png
/home/[your_cloned_server]/public_html/icon/mime/runtime.png
/home/[your_cloned_server]/public_html/icon/mime/swf.png
/home/[your_cloned_server]/public_html/icon/mime/conf.png
/home/[your_cloned_server]/public_html/icon/mime/package.png
/home/[your_cloned_server]/public_html/icon/mime/fon.png
/home/[your_cloned_server]/public_html/icon/mime/flv.png
/home/[your_cloned_server]/public_html/icon/mime/xsl.png
/home/[your_cloned_server]/public_html/icon/mime/vbs.png
/home/[your_cloned_server]/public_html/icon/mime/document.png
/home/[your_cloned_server]/public_html/awstats-icon
/home/[your_cloned_server]/etc/php.ini
/home/[your_cloned_server]/cgi-bin/lang
/home/[your_cloned_server]/cgi-bin/plugins
/home/[your_cloned_server]/cgi-bin/lib

After cloning a virtual server you MUST run chown command to set up correctly the owner and group for the whole tree of files.

Just be careful some files cannot be changed so easy:

chown: changing ownership of './fcgi-bin/php7.0.fcgi': Operation not permitted
chown: changing ownership of './cgi-bin/php7.0.cgi': Operation not permitted

Wow, it looks like something went really wrong with cloning there! There shouldn't be any files left over owned by the old user.

Did you get any errors in the middle of the process?

I agree bad things happened. It is not only the ownership issue, see the others. There were no error in logs or in browser in cloning process.

I'm looking into this, and will also fix the issue of the wrong path being left in the .htaccess file.

However, it isn't practical to fix all script config files (like phpMyAdmin) as Virtualmin doesn't have internal knowledge of how every possible app stores it's settings.

The .htaccess issue will be fixed in the next Virtualmin release.

Some issues were not fixed.

Can you clarify what problems you are experiencing?

Issues posted at #3, #4, #5 are still present in the newest version.