When you use put in
ftp, it is the server which determines the permissions of the uploaded file.
Assuming you are using Solaris' ftp server (and not some third-party application), the information is in ftpaccess(4), which describes
These settings are relevant for uploaded files (these are independent of the client permissions):
defumask umask class
umask applied to files created by the FTP server if the remote user is a member of the named class. If class is not specified, then use the umask as the default for classes that do not have one specified. The mode of files created may be specified by using the
upload [absolute|relative] [
[-] root-dir dirglob yes|no owner group mode [dirs|nodirs] [d_mode]
Define a directory with dirglob that permits or denies uploads. If it does permit uploads, all newly created files is owned by owner and group and has their permissions set according to mode. Existing files that are overwritten retains their original ownership and permissions. Directories are matched on a best-match basis. For example:
upload /var/ftp * no
upload /var/ftp /incoming yes ftp daemon 0666
upload /var/ftp /incoming/gifs yes jlc guest 0600 nodirs
would only allow uploads into
/incoming/gifs. Files that were uploaded to
/incoming are owned by ftp/daemon and have permissions of 0666. Files uploaded to
/incoming/gifs are owned by jlc/guest and have permissions of 0600. The optional
nodirs keywords can be specified to allow or disallow the creation of new subdirectories using the
mkdir command. If the
upload command is used, directory creation is allowed by default. To turn it off by default, you must specify a user, group and mode followed by the
nodirs keyword as the first line where the
upload command is used in this file. If directories are permitted, the optional d_mode determines the permissions for a newly created directory. If d_mode is omitted, the permissions are inferred from mode. The permissions are 0777 if mode is also omitted. The
upload keyword only applies to users who have a home directory of root-dir. root-dir may be specified as * to match any home directory. The owner or group may each be specified as
*, in which case any uploaded files or directories are created with the ownership of the directory in which they are created. The optional first parameter selects whether root-dir names are interpreted as absolute or relative to the current chroot'd environment. The default is to interpret root-dir names as absolute. You can specify any number of
class=classname restrictions. If any are specified, this
upload clause only takes effect if the current user is a member of one of the classes.
In the absence of any matching
upload clause, real and guest users can upload files and make directories, but anonymous users cannot. The mode of uploaded files is 0666. For created directories, the mode is 0777. Both modes are modified by the current umask setting.
Rather wordy, but essentially saying:
- the default permissions on uploaded files are more lax than what you see, and
defumask allows the administrator to reduce those permissions globally, and
upload allows the administrator to fine-tune things.
In practice, most administrators probably just set
The permissions on uploaded files do not depend on your
umask setting in the shell outside the
ftp client. The Solaris
ftpaccess manual page implies (see its section on Permission Capabilities) that clients might be able to specify a umask, but its client does not list that as a command.
Even with the documented settings, some administrators find quirks, e.g.,