Server Administration

 < Day Day Up > 

wu-ftp provides a few commands to aid in the administration of the server. These commands are

  • ftpwho Displays information about current FTP server users

  • ftpcount Displays information about current server users by class

  • ftpshut Provides automated server shutdown and user notification

  • ftprestart Provides automated server restart and shutdown message removal

Each of these commands must be executed with superuser privileges because they reference the ftpaccess configuration file to obtain information about the FTP server.

Display Information About Connected Users

command provides information about users who are currently connected to the FTP server. Here's the command line:

 /usr/bin/ftpwho 

Table 22.3 shows the format of the output ftpwho displays.

Table 22.3. ftpwho Fields

Name

Description

Process ID

The process ID of the FTP server process.

TTY

The terminal ID of the process. This will always be a ? because the FTP daemon is not an interactive login.

Status

Status of the FTP process. The values are

S: sleeping

Z: zombie, indicating a crash

R: running

N: normal process

Time

The elapsed processor time the process has used in minutes and seconds.

Details

Tells what host the process is connecting from, the user who connected, and the current command that is executing.


Listing 22.5 shows a typical output of this command. It lists the process ID for the ftp daemon handling requests, the class that the particular user belongs to, the total time connected, what username the user is connected as, and the status of his session.

In addition to the information given about each connected user, ftpwho will also display the total number of users connected out of any maximum that might have been set in the ftpaccess file. This information can be used to monitor the use of your FTP server.

You can pass one parameter to ftpwho. (You can find the parameter by using the ftpwho--help command.) The single parameter you can pass to ftpwho is -v. This parameter prints out version and licensing information for wu-ftp, as shown here:

 # ftpwho Service class all: 10447 ?        SN     0:00 ftpd: localhost: anonymous/winky@disney.com: IDLE 1 users (no maximum) 

The output of ftpwho, using the -V option, which shows version information, is shown in Listing 22.5.

Listing 22.5. ftpwho -V Command Output
 Copyright © 1999,2000,2001 WU-FTPD Development Group.  All rights reserved. Portions Copyright © 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994   The Regents of the University of California. Portions Copyright © 1993, 1994 Washington University in Saint Louis. Portions Copyright © 1996, 1998 Berkeley Software Design, Inc. Portions Copyright © 1989 Massachusetts Institute of Technology. Portions Copyright © 1998 Sendmail, Inc. Portions Copyright © 1983, 1995, 1996, 1997 Eric P.  Allman. Portions Copyright © 1997 by Stan Barber. Portions Copyright © 1997 by Kent Landfield. Portions Copyright © 1991, 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.   Use and distribution of this software and its source code are governed  by the terms and conditions of the WU-FTPD Software License ("LICENSE"). If you did not receive a copy of the license, it may be obtained online at http://www.wu-ftpd.org/license.html.  Version wu-2.6.2-8 

Count the Number of Connections

/usr/bin/ftpcount counts the number of connected users to the FTP server and the maximum number of users allowed. This same information is found at the end of the output for the ftpwho command. This command only takes one parameter, -V, which displays the same output as the previous ftpwho example.

 # ftpcount Service class all                  -   4 users (no maximum) 

Use /usr/sbin/ftpshut to Schedule FTP Server Downtime

As with any public server administration, it is always good practice to let users of the FTP server know about upcoming outages, when the server will be updated, and other relevant site information. The ftpshut command allows the administrator to let the FTP server do much of this automatically.

The ftpshut command allows the administrator to take the FTP server down at a specific time based on some parameters passed to it. The format of the command is as follows and is documented in the ftpshut man page:

 ftpshut  [ -V ] [ -l min] [ -d min] time [ warning-message ... ] 

The -V parameter displays the version information of the command. The time parameter is the time when the ftpshut command will stop the FTP servers. This parameter will take either a + number for the number of minutes from the current time, or a specific hour and minute in 24-hour clock format with the syntax of HH:MM.

The -l parameter allows the FTP server administrator to specify how long, in minutes, before shutdown the server will disable new connections. The default for this is 10 minutes. If the time given to shut down the servers is less than 10 minutes, new connections will be disabled immediately.

The -d parameter is similar to the -l parameter, but controls when the FTP server will terminate the current connections. By default this will occur five minutes before the server shuts down. If the shutdown time is less than five minutes, the server will terminate the connections immediately.

When you execute this command, the FTP server creates a file containing the shutdown information in the location specified in the ftpaccess file under the shutdown section. The default configuration for this file is /etc/shutmsg. If you execute the ftpshut command with warning messages, the messages are displayed when the user logs in to the server.

 Name (pheniox:tdc): anonymous 331 Guest login ok, send your complete e-mail address as password. Password:  230-system doing down at Mon Sep  3 06:23:00 2001  230-0 users of unlimited on pheniox. 230 Guest login ok, access restrictions apply. Remote system type is Unix. Using binary mode to transfer files. 

Here is a sample ftpshut command:

 ftpshut -l 5 -d 5 +10 "system going down at %s %N users of %M on %R" 

This command tells the FTP server to disconnect new connections in 5 minutes, drop all current connections in 5 minutes, shut down the server in 10 minutes, and display a warning message to the users at login. The message can be a mixture of text and magic cookies, defined in Table 22.4. It is important to keep in mind that the message can only be 75 characters in length. Additionally, it is not important to know how many characters the magic cookies will take because the system knows this information and will truncate the message at 75 characters.

Table 22.4. Magic Cookies for the ftpshut Command

Cookie

Description

%s

Time the system will be shut down

%r

Time new connections will be denied

%d

Time the current connections will be dropped

%C

Current working directory

%E

Server administrators email address as specified in the ftpaccess file

%F

Available free space in the current working directories partition in kilobytes

%L

Local host time

%M

Maximum number of allowed connections in this user class

%N

Current number of connections for this user class

%R

Remote hostname

%T

Local time, in the form of Fri Aug 31 21:04:00 2001

%U

Username given at login


When ftpshut is issued to the system, it creates a file that stores the necessary information. The ftprestart command removes this file for all servers, either canceling the impending shutdown or removing the shutdown file and restarting the FTP server. The ftprestart only has one optional argument, -V, to show version information.

Using /var/log/xferlog to View a Log of Server Transactions

The xferlog file gives a log of what transactions have occurred with the FTP server. Depending on the settings in the /etc/ftpaccess file, the contents of this file can contain the files sent or received by who with a date stamp. Table 22.5 lists the fields of this file. The same information can also be found in the corresponding man page included in the wu-ftp RPM.

Table 22.5. /var/log/xferlog Fields

Field

Description

current-time

Current local time in the form of DDD MMM dd hh:mm:ss YYYY, where DDD is the day of the week, MMM is the month, dd is the day of the month, hh is the hour, mm is the minutes, ss is the seconds, and YYYY is the year.

transfer-time

Total time in seconds for the transfer.

remote-host

Remote hostname.

file-size

Size of the transferred file in bytes.

filename

Name of the file.

transfer-type

A single character indicating the transfer type. The types are

a for ascii transfers.

b for binary transfers.

special-action-flag

One or more character flags indicating any special action taken by the server. The values are

C for compressed files.

U for uncompressed files.

T for TARed files.

- for no special action taken.

direction

Indicates whether the file was sent from or received by the server.

access-mode

The way in which the user logged in to the server. The values are

a anonymous guest user.

g guest user, corresponding to the guestgroup command in the /etc/ftpaccess file.

r real user on the local machine.

username

If logged in as a real user, the username.

If the access mode was guest, the password is given.

service-name

The name of the service used, usually FTP.

authentication-method

Type of authentication used. The values are

0: none.

1: RFC931 Authentication (a properly formed email address).

authenticated-user-id

This is the user ID returned to the server based on the authentication method used to access the server. An * is used when an authenticated user ID cannot be found.

completion-status

A single character field indicating the status of the transfer. The values are

c: completed transfer.

i: incomplete transfer.


An example of this file is seen in Listing 22.6.

Listing 22.6. Sample /var/log/xferlog File with Inbound and Outbound Logging
 Mon Sep  3 07:13:05 2001 1 localhost.localdomain 100  /var/ftp/pub/README b  o a testing@test.com ftp 0 * c Mon Sep  3 02:35:35 2001 1 helios 8 /var/ftp/pub/configuration a  _ o a testing@test.com ftp 0 * c Mon Sep  3 02:35:35 2001 1 helios 8 /var/ftp/pub/temp.txt a  o a  testing@test.com ftp 0 * c Mon Sep  3 02:35:35 2001 1 helios 8 /var/ftp/pub/tftp-server- 0.17-14.i386.rpm a  o a testing@test.com ftp 0 * c Mon Sep  3 02:35:35 2001 1 helios 8 /var/ftp/pub/wu-ftpd-2.6.1- 22.i386.rpm a  o a testing@test.com ftp 0 * c 

Related Fedora and Linux Commands

You'll use these commands to install, configure, and manage FTP services in Fedora Core:

epiphany A graphical GNOME browser supporting FTP

ftp A text-based interactive FTP command

ftpcopy Copy directories and files from a FTP server

ftpcp Retrieve data from remote FTP server, but do not overwrite existing local files

gftp A graphical FTP client for GNOME

konqueror KDE's graphical web browser

lftp An advanced text-based FTP program

nautilus Red Hat's graphical file explorer and browser

ncftp A sophisticated, text-based FTP program

sftp Secure file transfer program

smbclient Samba FTP client to access SMB/CIFS resources on servers

system-config-services Red Hat's system service GUI admin utility

vsftpd The Very Secure FTP daemon

webcam A webcam-oriented FTP client included with xawtv


     < Day Day Up > 


    Red Hat Fedora 4 Unleashed
    Red Hat Fedora 4 Unleashed
    ISBN: 0672327929
    EAN: 2147483647
    Year: 2006
    Pages: 361

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net