domain
Change the primary domain of a hosting account, with an automatic snapshot first
- Command:
/go/domain - Category: Accounts
- Required arguments:
<current-domain>and<new-domain> - Optional flag:
--progress - Output: Status messages and the JSON result of
create. With--progress, also progress numbers. - Last updated: 2026-11-19
On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also
Overview
/go/domain moves an existing hosting account to a new primary domain. It:
- takes a snapshot of the current account with
snapshot - creates a new account for the new domain with
create - replaces the new account's empty home folder with the old account's folder
- re-points the account's records in the GoAdmio databases to the new domain
- removes the old system user, web server and PHP-FPM configuration, DNS zone, FTP permissions, and DKIM key
[!WARNING] The command has almost no safety checks. It does not validate its arguments, and it keeps going after errors. Read Before you run first.
Quick start
/go/domain old-example.com new-example.com
Syntax
/go/domain <current-domain> <new-domain> [--progress]
| Form | Behavior |
|---|---|
/go/domain <current-domain> <new-domain> |
Moves the account and prints plain status messages. |
/go/domain <current-domain> <new-domain> --progress |
Same, and also prints the progress numbers 10, 20, 30, 50, 70, and 100 on separate lines, for use by a progress bar. |
--progress is detected anywhere in the argument list.
[!WARNING] Always pass both domains, written in full and in lowercase. An empty argument can turn a later
rm -rf /home/<domain>intorm -rf /home/.
Before you run
- The new domain must not already be hosted, be an alias, or be waiting in the recycle bin. If
createrejects it, the script still continues, and it can delete the existing account's files and records for that domain. - The current domain must exist.
- Pass the domain exactly as
createwould store it (lowercase, nowww., with a TLD).createsilently normalizes the value but this script does not, soShoporshopwould be created asshop.comwhile the script keeps usingShop. - Point the new domain's DNS at this server, or expect a DNS warning and no SSL certificate at first.
- Plan for the email addresses to change, and for site settings that contain the old domain.
Arguments
| Argument | Required | Default | Notes |
|---|---|---|---|
<current-domain> |
Yes | — | The account's current primary domain, as stored in GoAdmio. |
<new-domain> |
Yes | — | The new primary domain. Becomes the account's domain and its username. |
--progress |
No | Off | Prints progress numbers. |
Output
| Outcome | What you get |
|---|---|
| Start | A snapshot of the current domain (<new-domain>) will be taken before changing the primary domain... (the message shows the new domain, although the snapshot is of the current one). |
| After the snapshot | Changing primary domain started now... |
| New account created | The single-line JSON result of create. It contains the new account's generated password in plain text. |
| Finished | Primary domain name changed successfully... |
The command always exits with code 0, including after errors, because it never calls exit and doesn't check the result of any step.
Progress numbers
With --progress, each number prints when that stage starts or finishes:
| Number | After |
|---|---|
10 |
The snapshot announcement. |
20 |
The snapshot finished, before the new account is created. |
30 |
The folder is moved and ownership is fixed. |
50 |
The database records are re-pointed. |
70 |
The old system user, PHP-FPM pool, and Apache config are removed. |
100 |
Everything is finished. |
Logging
Every run is appended to /var/log/go/domain.log with a timestamp and the arguments.
Examples
# Change the primary domain
/go/domain old-example.com new-example.com
# Same, with progress numbers
/go/domain old-example.com new-example.com --progress
# Check the result
ls /home/new-example.com
tail /var/log/go/domain.log
# Recommended follow-up: set a known password and request SSL
/go/password new-example.com 'N3wS3cureP4ss'
/go/ssl new-example.com
Troubleshooting
There is no rollback. If something goes wrong, restore from the snapshot taken at the start with snapshot or recover.
| Symptom | Likely cause | Fix |
|---|---|---|
| Another site's files or records disappeared | The new domain was already hosted. create failed, but the script kept going and deleted that domain's folder and rows. |
Restore that account from its own snapshot or backup. Check the new domain before running. |
Account named shop.com but folder and records use Shop or shop |
create normalizes the domain, the script doesn't. |
Pass the full, lowercase domain. |
| New account has default limits, email, and settings | The script does not load the old account's settings before calling create. See Notes for maintainers. |
Reapply the limits and settings, for example with the panel or contact. |
| FTP or SSH password unknown | create generated a random one and printed it in its JSON result. |
Run password with a known password. |
| Panel password is still the old one, but FTP/SSH has a new random one | The panel hash is carried over; the system user is recreated. | Run password to align them. |
| Old email addresses stop working | Addresses were rewritten to the new domain, with no forwarding. | Update mail clients and DNS MX records, and tell users the new addresses. |
| Website shows old URLs or errors | Site settings (for example a CMS URL) still contain the old domain. | Update them inside the site. |
| No SSL certificate for the new domain | DNS doesn't point here yet, or the certificate is requested about a minute after creation. | Fix DNS, then run ssl. |
| PostgreSQL databases missing for the new domain | postgre.db rows are not moved. |
Re-register them with postgre. |
| Old vhost still served | The web server was not reloaded after the old config files were deleted. | Run restart. |
Details
What it does
- Logs the call to
/var/log/go/domain.logand reads the operating system name from/usr/local/goadmio/linux/os.db. - Looks up the current account's username in
/var/lib/sqlite/site.db. - Takes a snapshot of the current domain with
snapshot. - Creates a new account for the new domain with
create. - Sets the account's username to the new domain.
- Deletes the new account's empty
/home/<new-domain>and moves/home/<current-domain>there. - Sets
wwwgroup tonobody,wwwownership to the new username, and/home/<new-domain>to755. - Runs
phpmyadminfor the new domain. - Deletes the placeholder rows
createjust made for the new domain in theSite,Alias,Subdomain,Directory,Mysql,Postgre,SQLite,Mail, andFtptables. - Updates the current domain's rows to the new domain and username in the
Site,SQLite,FTP,Httplog,Ftplog,Mysql,Mail,Subdomain,Directory,Github,Alias, andBlocktables. InMail, the old domain text inside each email address is replaced by the new one. - Deletes the old PHP-FPM pool files and the old Apache virtual host files for the operating system in use (AlmaLinux, Rocky, CentOS, Red Hat, Fedora, Debian, or Ubuntu).
- Deletes the old system user (
userdel -f) and/home/<current-domain>. - Deletes the old Nginx virtual host files.
- Deletes the old DNS zone with
zone. - Deletes
/etc/vsftpd/permission/<current-domain>and/etc/opendkim/<current-domain>.
flowchart TD
A["domain current new"] --> B["Snapshot current domain"]
B --> C["create new account"]
C --> D["Replace new home with old home"]
D --> E["Fix ownership, run phpmyadmin"]
E --> F["Delete placeholder rows, re-point old rows"]
F --> G["Remove old user, PHP-FPM, Apache, Nginx"]
G --> H["Remove old zone, FTP permissions, DKIM key"]
H --> I["Done"]
What changes and what doesn't
| Area | Result |
|---|---|
| Site files, mail folders, SQLite files, logs | Move with the home folder. |
| Panel records (sites, FTP, MySQL, mail, subdomains, directories, aliases, GitHub, blocks, HTTP and FTP logs) | Re-pointed to the new domain and username. |
| System/FTP/SSH user | New user named after the new domain; old user deleted. |
| Web server, PHP-FPM, DKIM, DNS zone, SSL request | Created for the new domain by create; old ones deleted. |
| Email addresses | Rewritten to the new domain. Old addresses stop working. |
| PostgreSQL records | Not moved. |
| Databases and database users | Not renamed by this script. |
Cloudflare DNS records, MX/SPF/DKIM for the new domain |
Not changed. Update them yourself. |
| Old domain's Let's Encrypt certificate files | Not removed by this script. |
| Content inside the site that contains the old domain | Not changed. |
Notes for maintainers
| Issue | Why it matters | Suggested fix |
|---|---|---|
Variables such as $Username, $Password, $DocumentRoot, $Email, $DiskSpace, and $PHPVersion are never set |
create receives empty values instead of the old account's settings. A block that loads the old Site row appears to be missing. Confirm that create treats empty options as unset. |
Read the old account's settings from the Site table before calling create. |
| No argument validation | An empty or malformed domain makes rm -rf /home/$Domain or rm -rf /home/$CurrentDomain target /home/. |
Exit unless both arguments are non-empty, and normalize and validate them as create does. |
Result of create is not checked |
After a failed create (for example, domain already hosted), the script deletes that domain's folder and rows. |
Exit unless the JSON contains "success": true. |
| Current domain is not checked | If it doesn't exist, the new account is created, then removed again, leaving leftovers. | Exit if $CurrentUsername is empty or /home/$CurrentDomain is missing. |
Snapshot message prints $Domain |
Shows the new domain instead of the current one. | Print $CurrentDomain. |
| Snapshot failure is not checked | The change continues without a safety copy. | Stop if snapshot fails. |
postgre.db is deleted for the new domain but never updated for the old one |
PostgreSQL records are lost. | Add an UPDATE Postgre ... line. |
replace(Email, '<old>', '<new>') |
Replaces the old domain text anywhere in the address, including the local part. | Replace only the part after @. |
| Domains are placed directly in SQL | A quote in the value breaks the query and can be abused. | Validate against ^[a-z0-9.-]+$. |
Final rm -rf /home/$CurrentDomain |
Redundant after mv, and dangerous if the variable is empty. |
Remove it, or guard it. |
| Web server is not reloaded after the old vhosts are removed | The old site can keep being served. | Reload the web server at the end. |
No rollback and always exits with 0 |
Failures are silent. | Use set -e or check each step, and exit non-zero on failure. |
Progress numbers skip 40, 60, and 80 |
The progress bar jumps. | Optional: add more steps or use evenly spaced values. |
See also
| Command | Description |
|---|---|
create |
Create a GoAdmio account from the command line |
snapshot |
Restic-based per-domain snapshot backup and restore |
recover |
Restore a deleted account from its latest snapshot |
password |
Change a GoAdmio account password from the command line |
primary |
Convert an addon domain to a primary domain |
username |
Change the GoAdmio account username |
zone |
Create, update, or delete a DNS zone file and register it with BIND |
ssl |
Install an SSL certificate for a domain in GoAdmio |