Site commands

These special server commands are specific to FTP4ALL, they do not appear in other ftp servers. Fortunately, the FTP protocol defines a "SITE" command, under which you can implement server/site specific commands.
To get a list of the site specific commands, issue a "SITE HELP" command in your ftp client. Some FTP clients do not support the "SITE" command. In this case, use "QUOTE SITE" instead. If your FTP client doesn't even support the "QUOTE" command, throw it away and get a better one !!! Another problem is that some UNIX FTP clients limit the numer of parameters for the "SITE" command. Again, use "QUOTE SITE" instead.
The site specific commands that FTP4ALL defines are mostly for superusers to maintain the running server. However, a few commands are also available to normal users.

Quick index of SITE commands
ADDUSER BIND * CHMOD CHMODR CHOWN *
CLOSE * COLOR COUNT DEL * DISABLE *
DUMP * ENABLE * EXEC * FF GROUP *
GROUPS + HELP INFO KICK * MOD
OPEN * PASSWD + REG * RUN SHUTDOWN *
USER/USR + VERSION W/WHO    
* this command is available for superusers or for site- or groupops with appropriate rights only
+ this command is just partially available for normal users

ADDUSER
Syntax: adduser <name> <group|gid> <password>
<1:ratio|limit|leech> <ident@ip0> [<ident@ip1> [<ident@ip2> [...]]]
Example: adduser dumbo users dumbo123 33 dumbo@127.0.0.1 *@123.123.123.123
This command is used to add users with one line while logged in the ftp daemon. (As an alternative to the site user commands)

BIND *
Syntax: bind [a|p|s] [<port>]
Example: bind a 4300

This command binds a service or admin port to a new port number. Changes take effect immediately, active sessions are not affected.

CHMOD
Syntax : chmod {ugo*}{+|-|=}{acgoplmn*} [<directory>]
Syntax : chmod {ugo*}{+|-|=}{rwx} <file>
Syntax : chmod d{+|-|=}h [<directory>]
Example: chmod g+gcl testdir
Example: chmod go-mra
Example: chmod u=*
Example: chmod *+r testfile
This command changes the access permissions of a directory or a file. The second parameter is the directory/file. If it is omitted, the current directory is used.
The first parameter consists of three parts. The first one (ugo*) specifies for who the permissions are to change. It is possible to give more than one character (see examples).

u : user g : group o : others * : user, group and others d : directory


The second part (+-=) says how to change the permissions.

+ : grant permission - : revoke permission = : set permission


The third part (acgoplm* for directories or rwx for files) gives the permission(s). For more than one type of permission, give the appropriate characters as a string (see examples).

a : access c : change to dir g : get file o : overwrite file p : put file
l : list dir m : make subdir n : no limit * : everything
h : directory is hidden: everybody who has no permission to cd to this dir does not see it in listings. Also, actions regarding hidden directories (e.g. MKDIR,UPLOAD,DOWNLOAD) are not shown by the SITE W command.


Access permission includes four rights: change mode, delete file, rename file and remove directory.

r : read file w : overwrite/delete/rename file x : change file permissions

CHMODR
This command works like CHMOD, but changes permissions for all subdirectories below the specified directory (=recursive). Works for files, too.

CHOWN *
Syntax : chown [<user>]:[<group>] [<directory>|<file>]
Example: chown user_x testdir
Example: chown :users filexxx
Example: chown user_x:users
This command changes the ownership of a directory or file. It can change both user and group. The tuple <user>:<group> is the first parameter. You can leave out either, but not both. If one is left out, only the other is changed, e.g. if you do not specify a user, only the group ownership is changed.
If you do not specify a file or directory, the current directory is assumed.

CLOSE *
Syntax : CLOSE
Example: CLOSE
This command closes the server temporarily. All normal user connections are closed and only the superusers remain logged in. From now, only superusers may log in. The server can be re-opened for normal users with the open command.

COLOR
Syntax : COLOR
Example: COLOR
Enables/Disables color support for the user. It acts like a switch to toggle between b/w and colormode. Colors are sent as standard ansi-color-sequences to the ftp-client. See the definition of color-variables at the ftp4all-variables page

COUNT
Syntax : COUNT
Example: COUNT
Counts all users who are currently logged in, except the invisible ones.

DEL *
Syntax : del <username> {<filename>|<directory>} [<factor>]
Example: del testuser x_dir 2
This command deletes a file or a directory and subtracts the amount of deleted data from the user's upload amount. This is useful when someone uploaded bad files, and you don't want him to get download credit for this. The file size is first multiplied with the factor and then subtracted from the upload amount. If you just want to delete the directory without reducing upload amounts, use factor zero.

DISABLE *
Syntax : disable <username>
Example: disable testuser
This command disables a user account. It can be enabled again with the ENABLE command. The server refuses login attempts to disabled accounts.

DUMP *
Syntax: dump <area>
Dumps debug information

ENABLE *
Syntax : enable <username>
Example: enable testuser
This command enables a disables user account again.

EXEC *
Syntax : exec <command> [<arguments>]
Example: exec ls -al
This executes a command on the server. The result is sent back over the control connection, i.e. you get a sequence of 200- lines. When the command finishes, the exit code is displayed. You can not run interactive commands such as a shell.

FF
Syntax : ff <wildcard>
Example: ff x123.*
This searches the current directory and all subdirectories from the current for certain files. All files and directories matching the given wildcard are displayed with the full path.

GROUP *
Syntax : group <subcommand>
Example: group add 123 megausers
Example: group change 123 new_grp
Example: group list
Example: group remove 123


subcommand syntax description
add <gid> <name> add new group
change <gid> <new_name> change group name
list list groups
remove <gid> delete group
With this command you can modify groups. Every group has a number (gid) and a name. Do not use the number -1 as gid, because it has a special meaning. The maximum length for a name is eight characters.

GROUPS +
Syntax : groups [<username> [{+|-}<group>]]
Example: groups user_x
It is now possible for a user to be in more than one group. The user must be at least in one group, this one is called primary group. This is the group in which the user is now. Furthermore, he can be in up to eight secondary groups. When a user uploads a file or creates a directory, the directory always gets the primary group.
Called without parameters, this command shows the groups the user is in. The superuser can use this command to add/remove users to/from groups. He can also look in which groups the user is by issuing this command without the second parameter.

HELP
Syntax : help [<site_command>]
Example: help chmod
This command displays help for a certain site command, or a list of all site commands when no parameter is given.

INFO +
Syntax : info [<user_information>] [<username>]
Example: info my_info
This command views or changes the user information. Called without parameters, the current user information is displayed. Every user can change his user information by typing it as the second parameter. Only superusers can change the user information of other users. In this case, the second parameter must be the user name.

KICK *
Syntax : kick <username>
Example: kick user_1
This command lets you kick a logged in user from the server. This is useful when you want to disable a user account and the is logged in at the moment.

MOD
Syntax : mod [<directory>|<file>]
Example: mod xdir
Example: mod yfile
This displays the permissions for the specified directory or file. This command is only available for directories you have cd permission to.

OPEN *
Syntax : open
Example: open
This re-opens the server after it was closed with the close command.

PASSWD +
Syntax : passwd <new_password> [<username>]
Example: passwd fool1234
Example: passwd dubbydoo user_1
With this command the password can be changed. Every user can change his own password, but only the superuser can change passwords of other users. In the first example, a user changes his password to "fool1234". The second example can only be performed as superuser. Here, the superuser changes the password for "user_1" to "dubbydoo". Password "-" means to clear the password.

REG *
Syntax :
reg del <key>
reg get <key>
reg list
reg set <key> <value>

With this command you can access the registry. list lists all keys and its values, del deletes a key, set sets a key to a certain value (and creates it if it does not exist), get gets the value of a single key.

RUN
Syntax : run <script> [<parameters>]
Example: run test 1 2 3
Users can run scripts/programs. The output of the script is shown as result. Scripts are placed under bin/ in the standard tree. Users can run scripts which are either in the directory of their group, or in the parent directory. The group directory is searched first for a script. The parameters are passed to the script via environment variables.

SHUTDOWN *
Syntax : shutdown
Example: shutdown
This is for closing down the server. All connections will be closed immediately, also the connection to the superuser that issued this command. After that, the server process terminates. You can also shut down the server by a kill command from a shell.

USER / USR +
Syntax : user <subcommand>
Syntax : usr <subcommand>
Example: user add new_user template
Example: user add new_su
Example: user change new_su uid=99 gid=2 ip0=*.*.*.*
Example: user list -nd group_x
Example: user lista
Example: user remove new_su


subcommand syntax description
add <name> [<template>] add new user *
addsu <name> [<template>] add new superuser *
change <name> {<field>=<value>} change user attributes *
list [<options>] [<username> | <groupname>] list user(s) +
lista list all logged in users *
remove <name> delete user *


With this command you can modify users. The add and addsu commands let you create a new user/superuser. When a template is given, the server creates the new user/superuser from this template. Otherwise the user gets default values for all his attributes. With change you can change user attributes. Possible values for field are:

<field> description
name username
uid user id
gid group id
limit user's download limit. if set to -1 the credits don't change at all. helpful for "static"-accounts.
ip[0-9|+|i] ip ranges from which the user may log in, up to 10 ranges are possible. ip+ inserts the ip at the first available position. ip- removes an ip/ip-range.
class user class, a=anonymous, n=normal, g=groupop, o=siteop, r,s=superuser, t=template
extra extra user settings, c = color (color), i = invisible, p = user can't change his passord, * = all, - = none
credit[+|-] set user's download credit, + increases credit, - decreases credit (all values in kilobyte)
mbcred[+|-] set user's download credit in MB, + increases credit in MB, - decreases credit in MB
logins how many time the user may be logged in simultaneous. zero means unlimited, maximum is 255.
With list and lista you get a list of all existing or currently logged in users. A normal user may use the list command, but he can only see himself. The list command accepts the following options (options must start with a -). You can specify more than one option.
a : anonymous usersd : disabled accounts n : normal usersr,s : superuserst : templates


With remove you can delete a user. If the user is logged in at the moment, he is logged out immediately.

VERSION
Syntax : version
This displays the server version.

W / WHO
Syntax : w or who
Example: w
This displays a list of all users that are currently logged in the server. Also, for every user the following information is printed:

If a user is idle, the last command he executed is printed in square brackets [ ]. Not all user commands can be seen with this command.