0142-0144.html

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 456 行

HTML
456
字号




<HTML>

<HEAD>

<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:FTP</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311739 //-->

<!-- TITLE=RED HAT LINUX 2ND EDITION //-->

<!-- AUTHOR=DAVID PITTS ET AL //-->

<!-- PUBLISHER=MACMILLAN //-->

<!-- IMPRINT=SAMS PUBLISHING //-->

<!-- PUBLICATION DATE=1998 //-->

<!-- CHAPTER=08 //-->

<!-- PAGES=0131-0152 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->









<P><CENTER>

<a href="0139-0141.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0145-0147.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-142"><P>Page 142</P></A>













<H5><A NAME="ch08_ 20">

log commands

</A></H5>









<P>Often for security purposes, you might want to log the actions of your FTP users. You do so

by using the log commands option. Each command invoked by the clients is sent to your log

file. The format of the command is

</P>





<!-- CODE SNIP //-->

<PRE>

log commands &lt;typelist&gt;

</PRE>

<!-- END CODE SNIP //-->











<P>where &lt;typelist&gt; is a comma-separated list specifying which kinds of users should be

logged. The three kinds of users recognized are anonymous, guest, and real. (See the description of

the class command earlier in this chapter for each user type's description.) For example, to log

all the actions taken by anonymous and guest users, you specify the following:

</P>





<!-- CODE SNIP //-->

<PRE>log commands anonymous,guest

</PRE>

<!-- END CODE SNIP //-->











<H5><A NAME="ch08_ 21">

log transfers

</A></H5>









<P>If you want to log only file transfers made by clients instead of their entire sessions with the

log commands statement, you should use log

transfers instead. The format of this command is

</P>





<!-- CODE SNIP //-->

<PRE>

log transfers &lt;typelist&gt; &lt;directions&gt;

</PRE>

<!-- END CODE SNIP //-->











<P>where &lt;typelist&gt; is a comma-separated list specifying which kinds of users should be

logged (anonymous, guest, or real), and

&lt;directions&gt; is a comma-separated list specifying which

direction the transfer must take in order to be logged. The two directions you can choose to

log are inbound and outbound.

</P>









<P>For example, to log all anonymous transfers that are both

inbound and outbound, you would use the following:

</P>





<!-- CODE SNIP //-->

<PRE>

log transfers anonymous inbound,outbound

</PRE>

<!-- END CODE SNIP //-->











<P>The resulting logs are stored in

/var/log/xferlog. See the section on this file for

additional information.

</P>









<H4><A NAME="ch08_ 22">





Miscellaneous Server Commands

</A></H4>









<P>The following set of commands provide some miscellaneous configuration items. Each

command adds a good deal of flexibility to the server making it that much more useful to you as

its administrator.

</P>









<H5><A NAME="ch08_ 23">

alias

</A></H5>









<P>The alias command allows you to define directory aliases for your FTP clients. They are

activated when the clients use the cd command and specify the alias. This capability is useful

to provide shortcuts to often requested files. The format of the command is

</P>





<!-- CODE SNIP //-->

<PRE>

alias &lt;string&gt; &lt;dir&gt;

</PRE>

<!-- END CODE SNIP //-->











<P>where &lt;string&gt; is the alias and

&lt;dir&gt; is the actual directory the users should be transferred

to. The following is an example of this command:

</P>





<!-- CODE SNIP //-->

<PRE>

alias orb_discography /pub/music/ambient/orb_discography

</PRE>

<!-- END CODE SNIP //-->





<A NAME="PAGENUM-143"><P>Page 143</P></A>













<P>Hence, if clients connect and use the command cd

orb_discography, they are automatically moved to the

/pub/music/ambient/orb_discography directory, regardless of their current

locations.

</P>









<H5><A NAME="ch08_ 24">

cdpath

</A></H5>









<P>Similar to the UNIX PATH environment variable, the

cdpath command lets you establish a list of paths to check whenever clients invoke the

cd command. The format of the cdpath command is

</P>





<!-- CODE SNIP //-->

<PRE>

cdpath &lt;dir&gt;

</PRE>

<!-- END CODE SNIP //-->











<P>where &lt;dir&gt; is the directory on the server to be checked whenever clients use the

cd command. Remember to use directories relative to the FTP home directory for your anonymous users.

An example of the cdpath command is

</P>





<!-- CODE SNIP //-->

<PRE>

cdpath /pub/music

cdpath /pub/coffee

</PRE>

<!-- END CODE SNIP //-->











<P>If clients enter the command cd instant, the server examines the directories in the

following order:

</P>









<OL>

<LI>          ./instant

<LI>          Aliases called instant (See the description of

alias for more information.)

<LI>          /pub/music/instant

<LI>          /pub/coffee/instant

</OL>









<H5><A NAME="ch08_ 25">

compress

</A></H5>









<P>The wu-ftpd server (the FTP server I have currently installed) offers a special feature that

allows the server to compress or decompress a file before transmission:

compress. This capability allows a client who might not have the necessary software to decompress a file to still be able

to fetch it in a usable form. (For example, a file on your server is compressed using

gzip, and a Windows client machine needs to get it but does not have the DOS version of

gzip available.)

</P>









<P>The format of the compress command is

</P>





<!-- CODE SNIP //-->

<PRE>

compress &lt;switch&gt; &lt;classglob&gt;

</PRE>

<!-- END CODE SNIP //-->











<P>where &lt;switch&gt; is either the string YES to turn on this feature or

NO to turn off this feature. &lt;classglob&gt; is a comma-separated list of classes to which this compress option applies.

</P>









<P>There is, of course, a catch to using this command. You need to configure the

/etc/ftpconversions file so that the server knows which programs to use for certain file

extensions. The default configuration supports compression by either

/bin/compress or /bin/gzip.

</P>









<P>Read the section on /etc/ftpconversions for details.

</P>





<A NAME="PAGENUM-144"><P>Page 144</P></A>















<H5><A NAME="ch08_ 26">

tar

</A></H5>









<P>Almost identical to the compress option, tar specifies whether the server will tar and untar

files for a client on demand. The format of this command is

</P>





<!-- CODE SNIP //-->

<PRE>tar &lt;switch&gt; &lt;classglob&gt;

</PRE>

<!-- END CODE SNIP //-->











<P>where &lt;switch&gt; is either the string YES to turn on this feature or

NO to turn off this feature. The &lt;classglob&gt; option is a comma-separated list of classes that this

tar command specifies.

</P>









<P>Like the compress command, this feature is also controlled by the

/etc/ftpconversions file. See the section on

/etc/ftpconversions for details.

</P>









<H5><A NAME="ch08_ 27">

shutdown

</A></H5>









<P>The shutdown command tells the server to check for a particular file periodically to see

whether the server will be shut down. By default, the RPMs you installed invoke the FTP server

whenever there is a request for a connection; therefore, you don't really need this option if you

plan to continue using it that way. On the other hand, if you intend to change the system so

that the server software is constantly running in the background, you might want to use this

option to perform clean shutdowns and to notify users accessing the site.

</P>









<P>The format of the shutdown command is

</P>





<!-- CODE SNIP //-->

<PRE>shutdown &lt;path&gt;

</PRE>

<!-- END CODE SNIP //-->











<P>where &lt;path&gt; is the full path of the file to check for shutdown information. When that

file does become available, it is parsed out and the information gained from it dictates the

behavior of the shutdown process as well as the

ftpshut program (discussed later in the chapter in

the section &quot;ftpshut&quot;). While there isn't any standard place for keeping this file, you might find

it handy to keep in /etc/ftpshutdown because it will be obvious along with the other FTP

configuration files. Make sure that the file is readable by root.

</P>









<P>The format of the file is

</P>





<!-- CODE SNIP //-->

<PRE>

&lt;year&gt; &lt;month&gt; &lt;day&gt; &lt;hour&gt;

&lt;minute&gt; &lt;deny_offset&gt;

&lt;disconnect_offset&gt; &lt;text&gt;

</PRE>

<!-- END CODE SNIP //-->











<P>where &lt;year&gt; is any year after 1970;

&lt;month&gt; is from 0 to 11 to represent January to

December, respectively; &lt;day&gt; is from 0 to 30;

&lt;hour&gt; is from 0 to 23; and &lt;minute&gt; is from 0 to 59.

The &lt;deny_offset&gt; parameter specifies the time at which the server should stop accepting new

connections in the form HHMM, where HH is the hour in military format and

MM is the minute. &lt;disconnect_offset&gt; is the time at which existing connections are dropped; it is also in

the form HHMM.

</P>









<P>The &lt;text&gt; parameter is a free-form text block displayed to users to alert them of the

impending shutdown. The text can follow the format of the

message command (see the description of this command earlier in the chapter) and have the following special character sequences

available:

</P>



<P><CENTER>

<a href="0139-0141.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0145-0147.html">Next</A>

</CENTER></P>









</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?