We often encourage our users to use software which is better, and does things in a standard way. When it comes to control panels we prefer Virtualmin. It works with the distro you are using and the packages that come with it rather than setting up things in its own odd way and tieing you into using strange configs that lock you into using it.
Also it imports from all other platforms nicely (cpanel, plesk etc) which is handy to those who are locked into a lot of the more overpriced web panels. But the best thing yet is that its a reasonable price, in fact the GPL version is free and fully functioning!
By default it uses FCGI for PHP, which is a great option, however we had a customer who was struggling to keep ram usage down so wanted to convert to mod_php which was slightly faster and used less memory. Since he had more than a few domains this could have been painstaking, in fact it was until i emailed one of the creators of Virtualmin.
Not only did i get a great response, but i got it within minutes!
I had wondered if Virtualmin had a command line interface, and thus asked if there was any command line way i could do it, i got this reply.
Yes – you can use the command :
virtualmin modify-web --domain whatever.com --mode mod_php"
You can combine this with a shell loop using the output from :
virtualmin list-domains --with-feature web --name-only
Something like :
for dom in $(virtualmin list-domains --with-feature web --name-only); do
virtualmin modify-web --domain $dom --mode mod_php
done
You can create a summary of SSL certificate information on the server with:
for dom in $(virtualmin list-domains --with-feature web --name-only); do echo $dom====;virtualmin get-ssl --domain $dom; done | egrep '===|cn:|notafter|alt:|issuer_o|type:' example.com==== cn: ads.example.com issuer_cn: R3 issuer_o: Let's Encrypt notafter: Feb 17 18:06:22 2022 GMT type: Signed by CA alt: ads.example.com
I modified this somewhat so i had an exclude list and then went with it. I think perhaps I should have put a sleep in there somewhere, the load went rather high for some time :)
[root@hostname ~]# virtualmin
usage: /usr/sbin/virtualmin [args..]
or: /usr/sbin/virtualmin help
Available commands :
Backup and restore
------------------
backup-domain Backup one or more virtual servers
list-scheduled-backups Outputs a list of scheduled backups
restore-domain Restore one or more virtual servers
Virtual servers
---------------
create-domain Create a virtual server
delete-domain Delete one or more virtual servers.
disable-domain Temporarily disable a virtual server
enable-domain Re-enable one virtual server
migrate-domain Imports a virtual server from some other product
modify-domain Change parameters of a virtual server
move-domain Change the owner of a virtual server
unalias-domain Convert an alias domain into a sub-server.
unsub-domain Convert a sub-domain into a sub-server.
list-domains Lists all virtual servers.
notify-domains Send email to some or all virtual server owners.
validate-domains Check the configuration of virtual servers
enable-feature Turn on some features for a virtual server
disable-feature Turn off some features for a virtual server
modify-dns Change DNS settings for virtual servers
modify-spam Change spam filtering and delivery settings for a
virtual server
modify-web Change a virtual server's web configuration
modify-mail Change mail-related settings for some domains
resend-email Re-send the signup email for a domain
Mail and FTP users
------------------
create-user Create a mail, FTP or database user
delete-user Delete a mail, FTP or database user
modify-user Change attributes of a mail, FTP or database user
list-users List users in a virtual server
list-available-shells List all shells for use with domain owners and
mailboxes
list-mailbox Dump inbox email for one user
Mail aliases
------------
create-alias Create a new mail alias
create-simple-alias Adds a mail alias to some domain, with simple
parameters
delete-alias Delete a mail alias
list-aliases List aliases for a virtual server
list-simple-aliases Lists mail aliases in a simple format for some domain
create-simple-alias Adds a mail alias to some domain, with simple
parameters
list-simple-aliases Lists mail aliases in a simple format for some domain
Server owner limits
-------------------
disable-limit Removes access to some feature or edit capability for
some virtual servers
enable-limit Grants access to some feature or edit capability for
some virtual servers
modify-limits Changes the owner limits for some virtual server
modify-resources Changes resource limits for some virtual server(s)
Extra administrators
--------------------
create-admin Creates an extra administrator for a virtual server
delete-admin Deletes an extra administrator from a virtual server
modify-admin Updates an extra administrator for a virtual server
list-admins Lists administrators belonging to a virtual server
Custom fields
-------------
list-custom List custom fields for virtual servers
modify-custom Modify custom fields for a virtual server
Databases
---------
create-database Creates a database for a virtual server
delete-database Deletes one database
import-database Adds an existing database to a virtual server
list-databases Lists databases for some virtual server
modify-database-hosts Adds or removes an allowed MySQL host for some or all
domains
Reseller accounts
-----------------
create-reseller Create one reseller account
delete-reseller Delete one reseller
modify-reseller Modify attributes for an existing reseller
list-resellers List existing resellers
Script installers
-----------------
install-script Install one third-party script
delete-script Un-install one script from a virtual server
list-scripts Display script installed into some virtual server
list-available-scripts List known scripts
Proxies and balancers
---------------------
create-proxy Adds a per-directory proxy to some domain
delete-proxy Removes a proxy balancer from some domain
list-proxies Lists web proxy balancers in some domain
PHP versions
------------
delete-php-directory Remove any custom version of PHP for some directory
set-php-directory Set the version of PHP to run in some directory
list-php-directories List all directories in which a specific version of PHP
has been activated
SSL certificates
----------------
list-certs Output the certificates for some or all virtual
servers.
generate-cert Generate a new self-signed cert or CSR for a virtual
server.
install-cert Replace the SSL certificate or private key for a
virtual server.
Virtual server templates
------------------------
create-template Creates a template for use by new domains.
delete-template Removes one virtual server template.
get-template Outputs all settings in a template.
modify-template Changes one or more settings in a template.
list-templates List available templates for new domains
Account plans
-------------
create-plan Creates a new account plan for use with virtual
servers.
delete-plan Removes one existing account plan.
modify-plan Modifies an existing account plan for use with virtual
servers.
list-plans List available account plans for new domains
Other scripts
-------------
change-licence Change a system's Virtualmin license key
change-password Changes the password of some Virtualmin user.
check-config Run the Virtualmin config check
check-connectivity Checks the external accessibility of virtual servers.
copy-mailbox Copy mail from one location to another, perhaps
converting formats.
create-redirect Adds a web redirect or alias to some domain
create-shared-address Adds an IP address for use by multiple virtual servers
delete-redirect Removes a web redirect or alias from some domain
delete-shared-address Removes an IP address that can be used by virtual
servers
disable-writelogs Disable logging via program
enable-writelogs Enable logging via program
get-dns Output all DNS records for a domain.
get-ssl Output SSL certificate information for a domain.
info Show general information about this Virtualmin system.
licence-info Show license counts for this Virtualmin system.
list-bandwidth Shows bandwidth usage for some domain over a date range
list-commands Lists API scripts available
list-features Lists features available when creating a domain
list-php-ini Show PHP variables for some or all domains.
list-redirects Lists web redirects and aliases in some domain
list-shared-addresses Lists shared IP addresses for virtual servers
list-styles Lists all configuration templates
lookup-domain-daemon A background process for looking up user details.
modify-php-ini Changes PHP variables for some or all domains.
run-all-webalizer Run Webalizer reports for all virtual servers
search-maillogs Searches mail server and procmail logs
set-spam Change the spam and virus scanners for all domains
test-imap Checks if IMAP login to some server works.
test-pop3 Checks if POP3 login to some server works.
test-smtp Checks if the mail server can RCPT to some address

2 responses to “Virtualmin on the command line”
Thx, you guys rock, as usual! : )
Very nice! Thanks!
Question though, do you or anyone that reads this page aware of the location to edit the Script upgrade notification email that gets send out when a script installer gets an update?