config
Create GoAdmio's
config.php, which stores the database and SSH login settings
- Command:
/go/config - Category: System
- Required option: None
- Output: None on success (also logged to
/var/log/go/config.log) - Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/config writes the file /usr/local/goadmio/include/config/config.php. GoAdmio reads this file to find:
- the MariaDB/MySQL root password it uses to manage databases
- the SSH username and port it uses to connect to the server
The command only writes the file. It does not display the current settings. To read them, open the file itself.
It works in two modes, chosen by the number of arguments:
- Automatic mode (no arguments, or
--force): works out the values from the server and creates the file. It refuses to run if the file already exists. - Manual mode (exactly two arguments): writes the values you give. It overwrites an existing file without asking.
Quick start
# Create the file if it doesn't exist yet
/go/config
[!WARNING] The file contains the MariaDB root password in plain text. The command doesn't set permissions on it, so check that it isn't readable by other users. In manual mode the password you type is also saved, unmasked, in
/var/log/go/config.logand shown in your shell history.
Syntax
# Automatic mode
/go/config
# Delete the existing file and create it again, automatically
/go/config --force
# Manual mode
/go/config <MySQL root password> <SSH username>
| Form | Behavior |
|---|---|
/go/config |
Creates the file from detected values. If the file already exists, prints a message and exits with status 1. |
/go/config --force |
Deletes the file, then creates it from detected values. |
/go/config <MySQL root password> <SSH username> |
Writes the file with exactly these values and the SSH port 33. Overwrites the file if it exists. |
The mode is chosen by counting arguments. Anything other than exactly two arguments is automatic mode, so use --force on its own. If you add other arguments, either the values you pass are ignored (three or more arguments) or --force is taken as the password (/go/config --force <value>).
Options
| Option | Required | Default | Notes |
|---|---|---|---|
--force |
No | — | Deletes config.php before running. Use it alone. |
Output
The command prints nothing when it succeeds. Every run is logged with its arguments and a timestamp, for example [Nov 20 09:15:02]# config --force, to /var/log/go/config.log.
| Situation | What you see |
|---|---|
| File created | Nothing. |
File already exists (automatic mode, no --force) |
/usr/local/goadmio/include/config/config.php File Already Exists. The command exits with status 1. |
Examples
# Create the file on a new server
/go/config
# Back up the file, then regenerate it
cp -p /usr/local/goadmio/include/config/config.php /root/config.php.bak
/go/config --force
# Write specific values (single quotes protect special characters in the shell)
/go/config 'MyDbPassword' goexample
# View the result, and check who can read it
cat /usr/local/goadmio/include/config/config.php
ls -l /usr/local/goadmio/include/config/config.php
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
config.php File Already Exists. |
The file is already there. | Back it up, then run /go/config --force. |
DBPass is empty after running |
Automatic mode reads the password from /root/.my.cnf, and that file is missing or has no password= line. |
Use manual mode, or edit DBPass in the file. |
--force lost the database password |
The old file was deleted before the new one was built. | Restore your backup, or enter the password with manual mode. Back up before using --force. |
| PHP errors, or GoAdmio can't read the file after manual mode | The password contains ", $, or \, which break the PHP string. |
Avoid these characters, or edit the file and escape them. |
Invalid GoAdmio Path (Run: /go/config --force) |
A PHP script that includes the file was run from outside /usr/local/goadmio. |
Run the script from the GoAdmio folder. --force doesn't change this check. |
| GoAdmio can't connect over SSH | SSHUsername or SSHPort doesn't match the server. |
Check both values in the file against the server's actual SSH settings. |
| The SSH username differs from before | It is derived from the server's public IP and MAC address, and one of them changed. | Use manual mode to set the username you need. |
The SSH username looks wrong or the port is 22 unexpectedly |
The server couldn't reach checkip.amazonaws.com, or ifconfig isn't installed. |
Check the server's internet access and that net-tools is installed, then run --force. |
| The port in the file is wrong | /etc/ssh/sshd_config has several lines containing Port, or a commented one. |
Edit SSHPort in the file. |
| The file is readable by other users | The command doesn't set permissions. | Restrict it, for example chmod 600 with the owner GoAdmio needs. |
Details
What the file contains
<?php
if (substr(getcwd(),0,18) == "/usr/local/goadmio")
{
$DBHost="localhost";
$DBName="go";
$DBUser="root";
$DBPass="<MySQL root password>";
$SSHHost="localhost";
$SSHUsername="<SSH username>";
$SSHPort="<SSH port>";
}
else
{
echo "Invalid GoAdmio Path (Run: /go/config --force)";
exit;
}
?>
The variables are only defined when the PHP script that loads the file is running from a folder inside /usr/local/goadmio. From anywhere else, the file prints the Invalid GoAdmio Path message and stops the script.
| Setting | Automatic mode | Manual mode |
|---|---|---|
DBHost, DBName, DBUser |
localhost, go, root |
Same |
DBPass |
Password from /root/.my.cnf, or empty |
Your first argument |
SSHHost |
localhost |
Same |
SSHUsername |
go followed by 13 characters of an MD5 hash of the public IP and MAC address |
Your second argument |
SSHPort |
Detected, see below | 33 |
Automatic mode steps
- If
--forcewas given, deletes the existing file. - If the file still exists, prints the message and exits.
- Creates the folder
/usr/local/goadmio/include/config. - Gets the server's public IPv4 address from
checkip.amazonaws.comand its MAC addresses fromifconfig, and builds the SSH username from them. - Reads the MariaDB root password from
/root/.my.cnf, if it exists. - Detects the SSH port.
- Writes the file.
- Runs
ssh, which rewrites/etc/ssh/sshd_configwith GoAdmio's hardening and resets the port to22.
The SSH port is detected before ssh runs, so if that command changes the port, SSHPort in the file may hold the old value. Check it afterwards.
SSH port detection
| Check | Result |
|---|---|
| Manual mode | 33 |
Dropbear configuration found (/etc/sysconfig/dropbear or /etc/default/dropbear) |
The port reported by dropbear port |
/etc/ssh/sshd_config found |
The number from its Port line |
Otherwise, or if the result is 0 |
22 |
Notes
- Manual mode doesn't run
sshand doesn't check for an existing file. - If you change the MariaDB root password,
DBPassmust be changed to match. Commands such ascollectmailread the password from this file.
See also
| Command | Description |
|---|---|
ssh |
Rewrite /etc/ssh/sshd_config with GoAdmio hardening |
dropbear |
Install Dropbear in GoAdmio |
port |
Change the default SSH port (22) to another port |
mysqlset |
Change the MySQL root password |
mysqlreset |
Change the MySQL root password in safe mode |
load |
Load the server configuration |
save |
Save the server configuration |