GoAdmio

fm

Deploy the File Manager files for one or all domains, and open or close timed File Manager sessions

On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also


Overview

/go/fm supports the web-based File Manager. It does three jobs:

[!WARNING] While a session is open, every file in the site's www folder is set to 777, which makes it writable and executable by every user on the server. The permissions return to normal only when the logout sweep runs. See Syntax.


Quick start

# Deploy the File Manager files for one domain
/go/fm example.com

# Deploy them for every domain
/go/fm all

Syntax

/go/fm
/go/fm <domain> login
/go/fm <domain>
/go/fm all
Form Behavior
/go/fm Logout sweep. Closes the sessions that are more than two hours old, and runs fix for each of those domains.
/go/fm <domain> login Opens a session: saves the login time, sets every file in www to 777, makes the account user the owner, and hands the folders of FTP accounts to the FTP users.
/go/fm <domain> Deploys the File Manager files for that domain.
/go/fm all Deploys the File Manager files for every folder in /home that has a www folder.

Only the exact words login and Login open a session. Any other second word, such as logout or LOGIN, is ignored and the command deploys the files instead.

When sessions close


Arguments

Argument Required Default Notes
<domain> No — The account's primary domain, or all to deploy for every account.
login No — Opens a session for the domain. Only login and Login count.

The command has no --option flags.


Output

Outcome What you get
Logout sweep Logout: <domain> for each session that was closed. Exit code 1.
Login Nothing. Exit code 1.
Deploy Nothing. Exit code 0.
Domain not found, or no www folder Nothing, and nothing is changed.

Logging

The command appends one line for each call to /var/log/go/fm.log. The same file also receives the session events, in a different format:

2026-11-20 10:00:00 example.com Login
2026-11-20 12:05:00 example.com Logout

The Login line is written even if the domain doesn't exist or has no www folder, so it doesn't prove that a session was opened.


Examples

# Deploy for one domain
/go/fm example.com
# Redeploy for every domain, for example after updating GoAdmio
/go/fm all
# Open a session (normally done by the File Manager itself)
/go/fm example.com login
# Close expired sessions
/go/fm
# Check which domains have an open session
sqlite3 /var/lib/sqlite/site.db "SELECT Domain, FMStamp FROM Site WHERE FMStamp != 0"

Troubleshooting

Symptom Likely cause Fix
The File Manager is missing for a domain Its files haven't been deployed. Run /go/fm <domain>.
The File Manager is outdated after an update The deployed copies are not updated automatically. Run /go/fm all.
Site files are still 777 after use The logout sweep isn't running, or less than two hours have passed. Run /go/fm, or fix for the domain. Check that the sweep is in the panel's cron jobs.
The session ends after two hours while in use The limit is fixed. Log in again.
/go/fm <domain> logout did not end the session logout is not a form. It deployed the files instead. Run fix to restore the permissions. The session record clears at the next sweep after two hours.
An FTP user got ownership of a folder On login, FTP accounts whose directory is outside www receive ownership of it. See fix.
A site locked in 555 mode became writable A session unlocks it on purpose, and the logout sweep locks it again. Wait for the sweep, or run /go/fix <domain>.
A customer's edits to the File Manager files were lost A deploy replaces index.php and advanced.php in the domain's copy. Expected.
Exit code 1 after a login or a sweep By design. Ignore it for those forms.

Details

What it does

With no arguments (logout sweep):

  1. Finds the domains whose session start time is set and older than two hours.
  2. For each one: prints Logout: <domain>, logs it, clears the session time, and runs fix for the domain.
  3. Exits with code 1.

With <domain> login:

  1. Logs the login.
  2. If /home/<domain>/www exists: saves the current time as the session start, runs chmod -R 777 on www, and makes the account user the owner of www.
  3. For each FTP account of the domain whose directory does not end in /www: makes the FTP user the owner of that directory, recursively.
  4. Exits with code 1.

With <domain> or all (deploy):

  1. For each account that has a www folder, creates /usr/local/goadmio/home/go/fm/<domain>.
  2. Removes index.php and advanced.php there and copies fresh versions from /usr/local/goadmio/home/go/fm/.
  3. Sets the folder to 755 and makes the account user its owner, so the File Manager for that domain runs under the account's own user.

create runs the deploy step for every new account.

flowchart TD
    A["fm arguments"] --> B{"Any arguments?"}
    B -- "No" --> L["Logout sweep: close sessions older than 2 hours, run fix"]
    B -- "Yes" --> C{"Second argument is login?"}
    C -- "Yes" --> I["Open session: chmod 777 and chown www, chown FTP folders"]
    C -- "No" --> D["Deploy File Manager files for the domain or all"]

Notes for maintainers

Issue Why it matters Suggested fix
Login runs chmod -R 777 on the whole site Every user on the server can change the site for up to two hours, and indefinitely if the sweep isn't scheduled. Don't change modes. Make the File Manager run as the account user, or grant access with ACLs.
Sessions have a fixed two-hour limit and no logout form No way to end a session early, and logout silently deploys files. Add a logout form, and refresh the timer on activity.
An unrecognized second argument runs the deploy, and LOGIN is rejected Typos have an effect. Validate the second argument, and accept it in any case.
The sweep and the login exit with 1 Success looks like failure. Use exit 0.
The domain is not validated and goes into SQL and into paths A quote or .. in the value breaks the query, or points the commands at other folders. Validate against ^[a-z0-9.-]+$, and check that the domain is in the Site table.
all handles every folder in /home that has www, even if it isn't an account Stray folders get a File Manager folder owned by root. Skip domains that aren't in the Site table.
The FTP loop trusts the directory from the database, doesn't quote it, and splits it on spaces A directory such as the account root or mail is recursively handed to the FTP user. Check that it is inside www, quote it, and read line by line (the same issue as in fix).
Login is logged even when nothing happened The audit log can't be trusted. Log only after the checks pass.
One log file holds two formats Harder to read and parse. Use separate files.
rm then cp for the deployed files The File Manager is missing for a moment during the redeploy. Copy into place with install, or copy to a temporary name and mv.
The account user owns its copy of the files A customer can change the code that runs for their domain. Keep the files owned by root, and give the user only the data folders.
FMStamp is reused as the loop variable The cutoff value is overwritten inside the sweep loop. Use another name.

See also

Command Description
fix Fix GoAdmio file and folder permissions
create Create a GoAdmio account from the command line
ftp Create or edit FTP accounts for a domain
cron Set up main cron jobs in GoAdmio
jailedshell Enable or disable a chrooted SSH shell for a domain
shell Enable or disable SSH shell access for an account