ftp
Create, edit, delete, or toggle upload/download/delete permissions for a domain's FTP accounts
- Command:
/go/ftp - Category: FTP
- Required option: Positional arguments; which ones matter depends on the action (see Syntax)
- Output: A confirmation line, or an error message
- Last updated: 2026-11-21
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/ftp manages FTP sub-accounts for a hosted domain: creating one (with its own Linux system user, chrooted-style home directory, and vsftpd permission file), editing its password, deleting it, or toggling its upload, download, and delete permissions individually.
[!WARNING] Creating or editing an account calls
adduser,passwd, andusermodwithoutsudo, unlike every other command in this script (the SQLite inserts,mkdir,chown,chmod, andsystemctl restart vsftpdall usesudo). This script also has no root self-elevation check at the top, unlike several others in this reference. If this command is ever run by a caller that isn't already fully root, these specific calls can fail silently while the rest of the flow — the database row, the directory, the ownership, the "Account Created" message — still completes, leaving an FTP account that looks created but cannot actually log in, because the underlying Linux user was never made or updated. Confirm this script is only ever invoked as root before relying on it.
[!WARNING] The
DisableDeleteaction writes its restriction to the wrong file:/etc/vsftpd/permission/$Username(the domain's own main account) instead of/etc/vsftpd/permission/$User(the sub-account you're actually targeting, used correctly by every other toggle action). As written, disabling delete for a sub-account does not restrict that sub-account at all, while potentially changing the domain's main FTP account's permissions instead. The database is still updated to say delete is disabled for that sub-account, so the recorded state and the enforced behavior disagree. See Known issues.
The call is appended to /var/log/go/ftp.log.
Quick start
# Create an FTP sub-account under a domain's www folder
/go/ftp example.com /home/example.com/www/uploads uploaduser 'MyP[DollarSign]ssw0rd'
Syntax
/go/ftp <domain> <directory> <user> <password>
/go/ftp <domain> <directory> <user> <password> edit
/go/ftp "" "" <user> "" delete
/go/ftp "" "" <user> "" EnableUpload
/go/ftp "" "" <user> "" DisableUpload
/go/ftp "" "" <user> "" EnableDownload
/go/ftp "" "" <user> "" DisableDownload
/go/ftp "" "" <user> "" EnableDelete
/go/ftp "" "" <user> "" DisableDelete
All five arguments are positional: domain, directory, user, password, action. For the toggle and delete actions, only user (and, for delete, domain, via the stored site username) actually matter — the others can be left empty, but their positions must still be there.
| Form | Behavior |
|---|---|
/go/ftp <domain> <directory> <user> <password> |
Creates a new FTP sub-account. |
... edit |
Changes the password for an existing sub-account. |
... delete |
Removes the sub-account's system user and permission file, and its database row. |
... EnableUpload / DisableUpload |
Toggles whether the account can upload files. |
... EnableDownload / DisableDownload |
Toggles whether the account can download files. |
... EnableDelete / DisableDelete |
Toggles whether the account can delete files — but see the warning above about DisableDelete. |
Options
| Argument | Notes |
|---|---|
<domain> |
The hosted domain; used to look up its system username and (for new accounts) to validate the directory. |
<directory> |
Must start with /home/<domain>/ (see Known issues about how this is checked). |
<user> |
The FTP sub-account's Linux username. Not validated for length or character rules the way hosting account usernames are (see create). |
<password> |
See Password encoding for the placeholder scheme, and the warning above about unquoted use. |
<action> |
One of edit, delete, EnableUpload, DisableUpload, EnableDownload, DisableDownload, EnableDelete, DisableDelete, or omitted to create a new account. |
Password encoding
Because a raw password can contain shell- or URL-sensitive characters, the panel is expected to send four characters as placeholder tokens, which this command decodes before using the password:
| Placeholder | Becomes |
|---|---|
[DollarSign] |
$ |
[AndSign] |
& |
[EqualSign] |
= |
[HashSign] |
# |
Other characters, including a literal space, are not placeholder-encoded and are passed through as-is — see the warning about unquoted use below.
Output
Account uploaduser Created.
-----------FTP Account Info----------
Host: example.com
Username: uploaduser
Password: MyP$ssw0rd
uploaduser: FTP upload is currently disabled.
Invalid directory path.
example.com already exists.
Username uploaduser not exists.
Examples
# Create a sub-account
/go/ftp example.com /home/example.com/www/uploads uploaduser 'Str0ngP[HashSign]ss'
# Change its password
/go/ftp example.com /home/example.com/www/uploads uploaduser 'NewP[DollarSign]ss' edit
# Disable uploads for it
/go/ftp "" "" uploaduser "" DisableUpload
# Delete it
/go/ftp "" "" uploaduser "" delete
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| "Account Created" is shown, but the new FTP login doesn't work | The adduser/passwd steps ran without sudo and may have failed silently. |
See the warning above; confirm the command runs fully as root. Check id <user> afterward. |
| Disabling delete for a sub-account doesn't actually stop it from deleting files | DisableDelete writes to the wrong permission file. |
See the warning above. Edit /etc/vsftpd/permission/<user> by hand to add cmds_denied=DELE,RMD until this is fixed. |
| The domain's own main FTP account unexpectedly can't delete files | The same DisableDelete bug wrote a cmds_denied line into the domain's own permission file instead of the sub-account's. |
Remove the stray line from /etc/vsftpd/permission/<domain's site username> if it wasn't intended. |
A brand-new account's creation prints a scary-looking integer expression expected error, but the account still gets created |
The existing-user check (id -u $User compared with -ge 0) produces this harmless error for a username that doesn't exist yet, which is the normal case for a new account. |
Cosmetic only; the account creation still proceeds. |
| Repeated toggling of the same permission leaves duplicate lines in the permission file | Disable* actions append a line every time, without first checking whether it's already there. |
Harmless to vsftpd, but clean up the file by hand if it bothers you. |
| A password containing a space doesn't work as expected | $Pass is used unquoted in openssl passwd $Pass and usermod -p $Pass, so a space splits it into separate arguments. |
Avoid spaces in FTP passwords, or fix the quoting. |
| Debian/Ubuntu FTP passwords seem to only need the first several characters to work | openssl passwd with no algorithm flag defaults to a weak, legacy hash that can truncate the effective password (commonly to 8 characters). |
Use a stronger explicit algorithm, for example openssl passwd -6. |
$Directory not exists. never seems to actually trigger |
By the time that check runs, the directory was already created moments earlier by an unconditional mkdir -p; this branch is effectively unreachable in normal use. |
Not actionable; informational only. |
Details
Creating an account
- Confirms
$Userdoesn't already exist as a system user (id -u). - Confirms
$Directorystarts with/home/<domain>/and creates it. - Inserts a row into the
Ftptable (storing the password as given — FTP authentication needs the literal password to hash, so it's kept recoverable, not stored as a one-way hash like a web login). - Creates the Linux user rooted at
$Directoryand sets its password (RHEL family:adduser+passwd --stdin; Debian/Ubuntu:adduser --disabled-password+usermod -pwith anopenssl passwdhash). - Sets ownership of the domain's home folder and
775permissions on the new directory. - Restarts
vsftpd.
Editing a password
Looks up the account, then resets its password the same way as step 4 above, depending on OS.
Deleting an account
Removes the database row, deletes the system user (without -r, so the directory itself — typically a subfolder of the domain's own site files — is left in place), and removes its vsftpd permission file.
Toggling permissions
Each toggle both updates /etc/vsftpd/permission/<user> and the Ftp table's matching column, so vsftpd and GoAdmio's own records normally agree — except for DisableDelete, see the warning above.
Known issues
adduser,passwd, andusermodrun withoutsudo, inconsistent with the rest of the script. See the warning above.DisableDeletetargets the wrong file ($Username, the domain's own account, instead of$User, the sub-account). See the warning above.DisableDeleteis also missing theexit 1its five sibling toggle actions all have, so execution falls through toward the account-creation logic further down. In practice this is usually caught by the "user already exists" check near the bottom, but it's accidental, not designed.- The directory check is a plain prefix/glob match, not a resolved path comparison.
[[ "$Directory" = /home/$Domain/* ]]doesn't account for..segments; a value like/home/<domain>/../../etc/somethingwould pass this check as written even though it doesn't actually stay inside the domain's folder once resolved. $Passis used unquoted inopenssl passwd $Passandusermod -p $Pass; a password containing a space is split into multiple arguments.openssl passwdis called with no algorithm flag on Debian and Ubuntu, which uses a weak, legacy default hash rather than a modern one such as SHA-512 (-6) — and can silently truncate the effective password.- No length or character validation on the FTP username, unlike the detailed rules
createapplies to hosting account usernames.
See also
| Command | Description |
|---|---|
ftplog |
Report FTP activity for a domain |
permission |
Enable or disable FTP permissions for a domain |
skeleton |
Create or reset the skeleton FTP template account |
vsftpd |
Install and configure the VSFTPD FTP server |
fm |
Enable File Manager or deploy File Manager files per domain |
create |
Create a GoAdmio account from the command line |