Installation and management of linuxFTP Server

Source: Internet
Author: User
Tags ftp client egrep
Installation and management of linuxFTP server-Linux Enterprise Application-Linux server application information. The following is a detailed description. Note:
Due to the time relationship, no detailed description is provided. For more information, see wu-ftp FAQ and ftpd and ftpaccess.
Man ftpd ).

1. ftp Server
1. inetd configuration file or xinetd. conf configuration file
The content of the/etc/inetd. conf file is as follows:
Ftp stream tcp nowait root/usr/sbin/tcpd in. ftpd-l-

The content of the/etc/xinetd. conf file is as follows:
Service ftp
{
Socket_type = stream
Protocol = tcp
Wait = no
User = root
# Only_from = 202.118.66.0
# Only_from + = 192.168.1.2
# Only_from + = localhost
Server =/usr/sbin/in. ftpd
Server_args =-l-
}


Related Files:/etc/services
Ftp-data 20/tcp
Ftp 21/tcp

2. ftp user (required for Anonymous FTP Server)
File:/etc/passwd and/etc/shadow

/Etc/passwd:
Ftp: x: 500: 50: Anonymous FTP User:/home/ftp:/bin/false

/Etc/shadow:
Ftp: *: 10689: 0: 99999: 7 :::

$ Finger ftp
Login: ftp Name: FTP User
Directory:/home/ftp Shell:/bin/false
Never logged in.
No mail.
No Plan.

3. DNS Configuration
Ftp in cname officail. domain. name.

4. Administrator email alias
File:/etc/mail/aliases (Solairs)
/Etc/aliases (Linux)
(Egrep aliases/etc/mail/sendmail. cf)

Ftp-admin: real-user-name@domain.name

Related commands: newaliases, create an email alias


Ii. File System Structure
1. Anonymous FTP directory structure
Sub-directories:
Bin (ls, gzip, tar, and other binary executable files used by anonymous ftp users)
Etc (passwd, group)
Lib (Dynamic Connection Library, ld-2.0.7.so, ld-linux.so.2, ldd ../bin/ls, etc)
Pub (downloadable files)

2. passwd and group files
Do not use the passwd and group files of the system. It is best to put only the user and group information needed.
Passwd file:
Ftpadm: x: 0: 0: Anonymous FTP:/home/ftp:/bin/false
Ftp: x: 60000: 60000: Anonymous FTP:/home/ftp:/bin/false
Group file:
Ftpadmin: x: 0:
Ftp: x: 60000:

3. file and directory attributes
Main directory/home/ftp master root, attribute 555
The bin owner is the root group, which has the following attributes: wheel or other: 111.
Etc.
Lib owner root, attribute 555
The pub owner is the root or ftp administrator, and the attribute is 555.

Do not use ftp as the owner of any files or directories!

[Hbwork @ helius/etc] $ cd/home/ftp/
[Hbwork @ helius ftp] $ ls-l
Total 4
D -- x 2 root 1024 Apr 8 bin
D -- x 2 root 1024 Jun 4 15:12 etc
Drwxr-xr-x 2 root 1024 Apr 8 lib
Dr-xr-sr-x 2 root ftp 1024 Apr 8 11: 18 Pu

$ Ls-l bin
[Root @ helius ftp] # ls-l bin/
Total 250
--- X -- x 1 root 15236 Apr 28 1998 compress
--- X -- x 1 root 46356 Sep 11 1998 cpio
--- X -- x 1 root 45436 Sep 11 1998 gzip
--- X -- x 1 root 29980 Sep 11 1998 ls
--- X -- x 1 root 110668 Sep 11 1998 tar
Lrwxrwxrwx 1 root 4 May 19 16:48 zcat-> gzip

$ Ls-l etc
Total 19
-R -- 1 root 57 Jun 4 15:12 group
-R -- 1 root 16372 Sep 11 1998 ld. so. cache
-R -- 1 root 83 Jun 4 15:12 passwd

(For more information about setting up anonymouse FTP on Solaris, see Wu-ftpd-faq)


4. Optional Directories
Incoming Owner: root Mode: 1733 (chmod 1733 incoming)

Iii. Testing and debugging
Egrep ftp/etc/inetd. conf
Ps ax | egrep inetd
Kill-HUP $ PID

$ Ftp localhost (or ftp 0)
Execute commands such as ls cd get to check the result.


Iv. wu-ftpd FTP server process

Enhanced Functions:
You can set different classes based on the user's IP address or host and user name.
According to the set class, the administrator can control its access permissions, such as preventing anonymous Users
Delete or overwrite existing files
. Automatically executes uncompress, compress, tar, gzip, and other functions.
. Records all upload/download and each command sent by the ftp client.
. Allows smooth ftp server shutdown

Related configuration files:
Ftpaccess
Ftpconversions
Ftphosts
Ftpuser

Related commands:
Strings/usr/sbin/in. ftpd | egrep ftpaccess

1. Compile wu-ftpd

Latest: wu-ftpd-2.5.0
Ftp://ftp.dlut.edu.cn/pub/unix/ftp/servers/

$ Tar-zxvf wu-ftpd-2.5.0.tar.gz
$ Wu-ftpd-2.5.0 cd
We recommend that you refer to the INSTALL, README, upload. configuration. HOWTO file before compiling and installation.
To customize your own wu-ftpd, You can edit the src/pathnames. h file.
$ Build help
View compilation help

$./Build lnx
$ Su
#./Build install

2. command line options
-D Sends debugging information to syslog
-A Enable the use of the ftpaccess file (This is the default)
-A Disable the use of the ftpaccess file
-L Cause ftpd to log all USER commands.
-I Causes ftpd to log all incoming (upload) file in the xferlog
File (See pathnames. h)
-O Causes ftpd to log all outgoing (download) files in the xferlog file

3. File ftpconversions
Doc/examples/, used to specify the real-time compression or expansion (on-the-fly) for get ).

This file does not need to be modified unless otherwise

4. ftpaccess
(1) define a class
Three user types: real anonymous
Guest (provide the corresponding password)
Format:
Class classname type [, type,...] address [address...]

Example:
Class local real * .dlut.edu.cn 202.118.66 localhost
Class anonymous *


(2) Access Denied
Deny * .net.cn/etc/ftpmsgs/msg. denied

(3) Restrict Access
Limit class number times messages

Limit anonymous 200 SaSu
Limit anonymous 100 Any/etc/ftpmsgs/msg. toomany


Loginfails 2
Tar no anonymous
Compress no anonymous

Chmod yes | no type [type...]
Delete yes | no type [type...]
Overwrite yes | no type [type...]
Rename yes | no type [type...]
Umask yes | no type [type...]

Passwd-check none | trivial | rfc822 enforce | warn

(5) banner
Information displayed before the User login
Banner/etc/ftpmsg/banner. msg

The following variables can be referenced in the banner. msg file:
% C Current working directory
% E Email address of the administrator (email ftpadm@dlut.edu.cn)
% F is available in the directory
% L hostname
% M maximum allowed connections
% N number of current connections in the same class
% R The client host 'name or ip address
% T Current local time
% U The name the user specified at login

Example file:
Welcome to this test FTP Archive, running on % L.

Please contact % E with any technical problems you may have
Accessing this archive.

You are currently user % N out of a maximum % M users. It's
% T in PRC.

(6) message command
Message pathname login
Message pathname cwd = dir
Message. conents cwd = *
The cwd = dir is displayed only when the directory is changed for the first time.

(7) readme command
Readme pathname [login | cwd = dir] [class] [class]

Readme README * cwd = *

(8) shutdown command (abnormal on 2.5.0)
Shutdown pathname

(9) log command

Log commands type [type...]

Log transfer type [type...] direction [, direction]

(10) alias
Alias source:/pub/local/sw/source

(11) cdpath
Cdpath/pub/pub1

Upload Control
Upload hierarchy directory yes | no owner group mode [dirs | nodirs]

The following wu-ftpd-2.5.0/etc/ftpaccess file in the upload configuration (you can try the FTP
Server upload, but do not upload too large files)

# FTP-home-dir archiv-dir allow? Owner group mode dirs?
# (As in/etc/passwd)

Upload/home/ftp * no
Upload/home/ftp/pub3/incoming/windows yes ftpadmin ftp 0664 dirs
Upload/home/ftp/pub3/incoming/windows/* yes ftpadmin ftp 0664 dirs
Upload/home/ftp/pub3/incoming/unix yes ftpadmin ftp 0666 dirs
Upload/home/ftp/pub3/incoming/unix/* yes ftpadmin ftp 0666 dirs
Upload/home/ftp/pub3/incoming/other yes ftpadmin ftp 0666 dirs
Upload/home/ftp/pub3/incoming/other/* yes ftpadmin ftp 0666 dirs
Upload/home/ftp/pub3/incoming/WDI yes ftpadmin ftp 0666 dirs
Upload/home/ftp/pub3/incoming/WDI/* yes ftpadmin ftp 0666 dirs


5. ftphosts File
Allow ftp * .dlut.edu.cn
Allow anonymous * .dlut.edu.cn
Deny ftp * .dlmu.edu.cn
Deny ftp * .dlmu.edu.cn 202.118.80 .*


6. Utility

Ftpcount
Ftpwho
Ftushut

Maintenance:
It is best to use the relative path when establishing a connection.
Create subdirectories Based on the software category.
It is best to create a corresponding description file or index file in each directory for your convenience.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.