The FTP directory is located at /ftp on the server, and it
contains only the /pub directory. Anonymous
FTP allows users to access files without entering a username and a password.
Anonymous users accessing your VPS v2 Virtual Server simply enter "anonymous" as the
username and their e-mail address as the password. Non-anonymous FTP requires a
user account (home directory) and FTP privileges.
Anonymous FTP
The FTP directory is located at /ftp on the server and
contains only pub. Place that anonymous
users can access and download in the /ftp/pub directory. Create other
directories as needed, but you do not need to set up specific FTP accounts for
users to download files from /ftp/pub.
Uploadable Directories for Anonymous Users
Users might occasionally need to upload files to your FTP
server. If you allow FTP uploads, confine these uploaded files to an incoming or
customer-accessed directory.
We recommend creating an” incoming” directory with
write-only permissions, to prevent users from changing or deleting other users'
uploaded files using a .ftpaccess file. If
users have “read” permissions on the /ftp/pub/incoming
directory, they could upload potentially embarrassing or illegal files where
other users could access them.
Making an incoming Directory
To make an incoming directory:
-
Type
% cd /ftp/pub.
-
Create a directory named incoming and set “write-only” permissions in
the .ftpaccess file.
% mkdir incoming
% vi .ftpaccess
User ftp
Group ftp
UserAlias ftp username
AuthAliasOnly on
RequireValidShell off
<Directory pub/incoming/>
<Limit STOR CWD XCWD>
AllowAll
</Limit>
<Limit READ DELE MKD RMD XMKD XRMD>
DenyAll
</Limit>
</Directory>
</Anonymous>
You can now upload content to the directory /ftp/pub/incoming or, within ftp, you can access
it anonymously at /pub/incoming.
Creating Logon Banners and Directory Messages
Some FTP servers display logon banners immediately after
logon that provide the user with helpful information about the FTP site that
they are accessing.Creating a Logon Banner
To create a logon banner:
-
Go to /ftp/pub.
-
Create a file named .welcome.
-
In the .welcome file, type the text
that you want the user to see.
The following is an example logon banner found on an FTP
server:
Welcome to ACME Rockets Inc Anonymous FTP Server!
Please send any questions or reports about this server to
ftp@acme-rockets.com.
Creating a Directory Message
Directory messages act in the same way that logon banners
do. When a user accesses a particular directory, a message appears that usually
contains information about what is in the directory and a word of caution
regarding system files.
You must verify that the correct configurations are
included within the /etc/proftpd.conf in
order to use this functionality. The .welcome
and .message files are set up by default
for the anonymous user. You must edit /etc/proftpd.conf
manually for other portions of the site.
# We want '.welcome' displayed at login, and '.message'
displayed
# in each newly chdired directory.
DisplayLogin .welcome
DisplayFirstChdir .message
-
Go to the directory where you want the message to appear.
-
Create a file named .message in that directory. The text message you
create in the .message file displays when
the user accesses that directory. For example, you could promote a demo version
of your company's software in the DEMO directory with a .message file
containing the following text:
This directory contains demo versions of ACME Rocket's
products:
missile.zip - Missile CAD(tm) Version 1.0 (DEMO)
nuke.zip – Thermo-Nuclear War Simulator(tm) Version 2.1
(DEMO)
Non-Anonymous FTP Accounts
Most customers use non-anonymous FTP on their servers.
Customers can then resell server space to clients and enable them to maintain
their own home pages. Additionally, companies who want to restrict downloads of
valuable information can use user and password-restricted FTP.
Adding FTP accounts enables you to control user access for
uploading or downloading Web files and files in the private upload/download
directories.
Adding Non-Anonymous FTP Accounts
You must add a user account to your server and specify the
ftp group for this user.
The default home directory option during user account
creation is /home/username such as,
/home/joe. This ideal location allows Joe to upload Web pages to his document
root, which is /home/joe/www/subhosted_domain.
An alternative is to create the Joe’s home directory under
/usr/local/apache/htdocs. For example,
Joe’s home directory could be created at /usr/local/apache/htdocs,
in which case Joe would be the Webmaster of the primary domain.
Maintenance
Server log files that record FTP transactions are located
in /var/log/messages. See Chapter 9 for information on maintaining log files.
Important Commands, Directories, and Files
The following table describes commands, directories, and
files for managing FTP accounts.
|
Name |
Type |
Description |
|
ascii |
ftp command |
Sets the file transfer type to network ascii. |
|
binary |
ftp command |
Sets the file transfer type to support binary files. |
|
bye, quit |
ftp command |
Terminates the FTP session. |
|
cd remote-directory |
ftp command |
Changes the working directory on the remote computer to
remote-directory. |
|
delete remote-file |
ftp command |
Deletes the remote file on the remote computer. |
|
dir or ls remote-dir |
ftp command |
Prints a directory contents list in the directory. If no
remote directory is specified, a list of the current working directory on the
remote computer is displayed. |
|
get remotefile localfile |
ftp command |
Retrieves the remote file and store it on the local
computer. If the local file name is not specified, it is given the same name
it has on the remote computer. |
|
help |
ftp command |
Prints an informative message about the meaning of a
command. If no argument is given, FTP prints a list of known commands. |
|
/ftp/pub |
directory |
The anonymous FTP Directory |
|
/ftp/pub/
incoming |
directory |
Suggested directory to receive uploaded files from
anonymous users. |
|
/home/user
name |
directory |
Default non-anonymous FTP home directory. |
|
/home/enetrics/www/enetrics.com/
username |
directory |
Alternate FTP user home directory, the Webmaster’s home
directory. |
|
/var/log/messages |
file |
Log file of FTP server transactions |
|
/etc/proftpd.conf |
file |
ProFTPD configuration file for FTP. |
[Previous] [Section Table of Contents] [Handbook Main Table of Contents] [Proceed to Chapter 6]
|