GoAdmio

permission

Turn FTP login, upload, download, or delete on or off for one domain

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


Overview

/go/permission controls what FTP users of one hosting account may do. Each run switches one permission on or off:

For each change, the command:

The command runs sudo internally, so run it as root or as a user with sudo rights.

[!WARNING] Every run restarts vsftpd, which disconnects all FTP sessions on the server, not only those of the domain you changed. Run it when a brief interruption is acceptable.


Quick start

# Stop FTP logins for a domain
/go/permission example.com DisableFTP

Syntax

/go/permission <domain> <action>

Both arguments are required. Each run applies one action. To change several permissions, run the command once for each.

Every run is recorded in /var/log/go/permission.log, with the time and the arguments you passed.


Options

Argument Required Notes
domain Yes The account's primary domain, which must exist and not be in the trash.
action Yes One of the eight actions below. Names are case-sensitive.

Actions

Action Effect Confirmation message
EnableFTP Allows FTP login. <domain>: FTP is currently enabled.
DisableFTP Blocks FTP login. <domain>: FTP is currently disabled.
EnableUpload Allows uploads. <domain>: FTP upload is currently enabled.
DisableUpload Blocks uploads and every other change to files. See What each action changes. <domain>: FTP upload is currently disabled.
EnableDownload Allows downloads. <domain>: FTP download is currently enabled.
DisableDownload Blocks downloads. <domain>: FTP download is currently disabled.
EnableDelete Allows deleting files and folders. <domain>: FTP delete is currently enabled.
DisableDelete Blocks deleting files and folders. <domain>: FTP delete is currently disabled.

Output

Outcome What you get
Action applied The confirmation message from the table above.
Account missing or in the trash Account <domain> not exists. Exit status 1. Nothing is changed.
Unknown action No message. Nothing is changed, but vsftpd is still restarted.

The confirmation is printed even if a step before it failed, so don't treat it as proof the change worked. Check the files listed in What each action changes when it matters.

Log

Each run appends one line to /var/log/go/permission.log:

[Nov 21 12:00:00]# permission example.com DisableFTP

Examples

# Block FTP login for a domain
/go/permission example.com DisableFTP
# Allow FTP login again
/go/permission example.com EnableFTP
# Make FTP read-only: no uploads, no other changes
/go/permission example.com DisableUpload
# Allow uploads but not deleting
/go/permission example.com DisableDelete
# Check whether FTP login is blocked
grep example.com /etc/vsftpd/user_list
# See the domain's other FTP restrictions
cat /etc/vsftpd/permission/example.com

Troubleshooting

Symptom Likely cause Fix
Account <domain> not exists The domain isn't an active account. Check the spelling. Use the primary domain, not the username.
No message appears The action name is misspelled. Names are case-sensitive. Use one of the eight actions listed under Actions.
sed: can't read /etc/vsftpd/permission/<domain> The domain's permission file doesn't exist. The Enable actions need it. Create the file, then run the command again.
FTP users were disconnected vsftpd is restarted on every run. Expected. Run it when a short interruption is acceptable.
After DisableUpload, users also can't delete, rename, or create folders vsftpd's write_enable=NO turns off every command that changes files. Expected. Use DisableUpload for a read-only account.
DisableFTP didn't stop a login The block is added under the domain name. A login with a different FTP username isn't covered. Check the account's FTP username.
Other domains were re-enabled by EnableFTP The command removes every line in user_list that starts with the domain. See the warning in What each action changes.

Details

What each action changes

All actions also run systemctl restart vsftpd at the end.

Action vsftpd change Database change (Site table)
EnableFTP Removes the domain's line from /etc/vsftpd/user_list. FTPStatus=1
DisableFTP Adds the domain to /etc/vsftpd/user_list. FTPStatus=0
EnableUpload Removes the write_enable line from /etc/vsftpd/permission/<domain>. FTPUpload=1
DisableUpload Adds write_enable=NO to /etc/vsftpd/permission/<domain>. FTPUpload=0
EnableDownload Removes the download_enable line from /etc/vsftpd/permission/<domain>. FTPDownload=1
DisableDownload Adds download_enable=NO to /etc/vsftpd/permission/<domain>. FTPDownload=0
EnableDelete Removes the cmds_denied line from /etc/vsftpd/permission/<domain>. FTPDelete=1
DisableDelete Adds cmds_denied=DELE,RMD to /etc/vsftpd/permission/<domain>. FTPDelete=0

Things to know:

[!WARNING] EnableFTP and the other Enable actions remove lines by their starting text, not by exact match. EnableFTP for example.com also removes a user_list line for example.com.au, because it starts with the same text.


See also

Command Description
ftp Create or edit FTP accounts for a domain
vsftpd Install and configure the VSFTPD FTP server
ftplog Import the vsftpd transfer log into the FTP log database and look up the country and organization of each IP
password Change a GoAdmio account's FTP, SSH, and panel login password for one domain or all domains
suspend Suspend a GoAdmio account via the command line