ºìÁªLinuxÃÅ»§
Linux°ïÖú

ProFtpd¿ìËÙÖ¸ÄÏ

·¢²¼Ê±¼ä:2006-02-22 01:02:30À´Ô´:ºìÁª×÷Õß:root
ProFTPDÊÇÒ»¸öUnixƽ̨ÉÏ»òÊÇÀàUnixƽ̨ÉÏ(ÈçLinux, FreeBSDµÈ)µÄFTP·þÎñÆ÷³ÌÐò£¬ËüÊÇÔÚ×ÔÓÉÈí¼þ»ù½ð»áµÄ°æȨÉùÃ÷(GPL)Ï¿ª·¢¡¢·¢²¼µÄÃâ·ÑÈí¼þ£¬Ò²¾ÍÊÇ˵ÈκÎÈËÖ»Òª×ñÊØGPL°æȨÉùÃ÷£¬¶¼¿ÉÒÔËæÒâÐÞ¸ÄԴʼÂë¡£

ProFTPDÉè¼ÆÄ¿±êÊÇʵÏÖÒ»¸ö°²È«ÇÒÒ×ÓÚÉ趨µÄFTP Server¡£Ä¿Ç°Unix»òÀàUnixƽ̨ÉÏFTP ServerÊ®·ÖÓÐÏÞ£¬×ʹÓõĿÖžÍÊÇwu-ftpdÁË¡£ËäÈ»wu-ftpdÓÐ׿«¼ÑµÄЧÄÜͬʱҲÊÇÒ»Ì׺ܺõÄÈí¼þ£¬È»¶øËüȴǷȱÁËÐí¶àWin32ƽ̨ÉÏFTP ServerµÄһЩÌØÉ«£¬Í¬Ê±wu-ftpd¹ýÈ¥Ò²Óв»Éٵݲȫ©¶´Â½Ðø±»·¢ÏÖ¡£ProFTPDµÄÔ­´´Õß±¾Éí¾ÍÔø¾­»¨·Ç³£¶àµÄʱ¼äÑ°ÕÒwu-ftpdµÄ©¶´¼ÓÒԸĽø²¢ÇÒÔö¼ÓÐí¶à¹¦ÄÜ¡£È»¶øÊ®·Ö²»ÐÒµÄÊÇ£¬ËûºÜ¿ìµØ·¢ÏÖÏÔÈ»wu-ftpdÐèҪȫ²¿ÖØеĸÄд²ÅÄܲ¹×ãǷȱµÄÉ趨ÄÜÁ¦ÒÔ¼°È±·¦µÄһЩ¹¦ÄÜ¡£ProFTPD²»ÊÇ´ÓÆäËüFTP ServerµÄ¼ÈÓÐԭʼÂëÐ޸Ķø²úÉúµÄ£¬Ïà·´µÄ£¬ËüÊÇÍêÈ«¶ÀÁ¢¶øÍêÕû¡¢ÖØиÄдµÄFTP Server¡£

ProFTPDµÄÖ÷Òª°üÀ¨ÈçÏÂÌص㣺
* µ¥Ò»Ö÷ÉèÖÃÎļþ£¬°üº¬Ðí¶àÖ¸ÁîÒÔ¼°ÆäÖ§ÅäµÄ×飬ÍêÈ«¶¼ÊÇÖ±¹ÛµÄÉ趨¡£Èç¹û¸÷λ¶ÔApache Web ServeµÄÉèÖò»Ä°ÉúµÄ»°ÏàÐÅÒ»¶¨»á¾õµÃÊ®·ÖÈÝÒײÙ×÷É趨¡£

* ÿ¸öĿ¼¶¼¿ÉÒÔ¶¨ÒåÒ»¸ö".ftpaccess"ÉèÖÃÎļþ£¬¾ÍÈçͬApacheµÄ".htaccess"ÎļþÒ»Ñù¿ÉÒÔÉ趨¸ÃĿ¼µÄ´æȡȨÏÞ¡£

* ¿ÉÉ趨¶à¸öÐéÄâFTP server£¬¶øÄäÃûFTP·þÎñ¸üÊÇÊ®·ÖÈÝÒס£

* ¿É¸ù¾ÝϵͳµÄ¸ºÔØ(load)Ñ¡ÔñÒÔµ¥¶ÀÔË×÷(stand-alone)·½Ê½»òÊÇÓÉinetdÆô¶¯¡£

* ÄäÃûFTPµÄ¸ùĿ¼²»ÐèÒªÌض¨µÄĿ¼½á¹¹¡¢ÏµÍ³¶þ½øÖÆÖ´ÐÐÎļþ»òÆäËüϵͳÎļþ¡£

* ProFTPD²»Ö´ÐÐÈκÎÍⲿ³ÌÐòÒÔÃâÔì³É°²È«Â©¶´¡£

* ¾ßÓÐÒþ²ØĿ¼»òÒþ²ØÎļþ£¬Ô´×ÔÓÚUnixÐÎʽµÄµµ°¸È¨ÏÞ£¬»òÊÇuser/groupÀàÐ͵ĵµ°¸È¨ÏÞÉ趨¡£

* Äܹ»ÒÔÒ»°ãʹÓÃÕßÔÚµ¥¶ÀÔË×÷(stand-alone)ģʽÏÂÖ´ÐУ¬ÒÔ¼õÉÙijЩ½åÓɹ¥»÷·½Ê½È¡µÃrootȨµÄ¿ÉÄÜÐÔ¡£×¢£º´Ë¹¦ÄÜÓëUnixµÄ²Ù×÷ϵͳÓйء£

* Ö§³Öϵͳ¼Ç¼ÒÔ¼°utmp/wtmp¡£
¼Ç¼µÄ·½Ê½Óëwu-ftpdµÄ±ê×¼ÍêÈ«¼æÈÝ£¬Ò²Ö§³Ö¼Ç¼ÄÚÈݵÄÑÓÉì¸ñʽ¡£

* Ö§³ÖShadow password£¬°üÀ¨ÁËÕʺÅʹÓÃÆÚÏÞÉ趨µÄ¹¦ÄÜ¡£

±àÒëºÍ°²×°¡¡

ProftpdÌṩÁ˶àÖÖ°²×°¸ñʽ£¬°üÀ¨Ô´´úÂ뷽ʽ¡¢RPM·½Ê½¡¢deb·½Ê½(debianÈí¼þ°ü)µÈ¡£±¾ÎÄÖ÷ÒªÌÖÂÛÔ´´úÂ뷽ʽµÄ°²×°¡£

´Óftp.proftpd.netÏÂÔØ×îа汾µÄproftpd-1.2.0rc3µ½Linux·þÎñÆ÷ÉÏ¡£È»ºó°´ÕÕÈçϲ½Öè½øÐд¦Àí£º

[root@ftpd /]# cp proftpd-1.2.0rc3.tar.gz /usr/src/
[root@ftpd /]# cd /usr/src
[root@ftpd src]# tar xvfz proftpd-1.2.0rc3.tar.gz
[root@ftpd src]# cd proftpd-1.2.0rc3
[root@pftd proftpd-1.2.0rc3]# ./configure
[root@pftd proftpd-1.2.0rc3]# make
[root@pftd proftpd-1.2.0rc3]# make install

µ½ÏÖÔÚΪֹ£¬ÄãÒѾ­Íê³ÉÁËproftpdµÄ±àÒëºÍ°²×°¡£²¢ÇÒÔÚ/usr/local/etc/Ŀ¼ÏÂÓÐÒ»¸öĬÈϵÄproftpdÅäÖÃÎļþproftpd.conf¡£

Æô¶¯²âÊÔ

¶ÔÓÚ±ÊÕßµÄÊÔÑéϵͳRedHat6.2À´Ëµ£¬ÐèÒª½«¸ÃÅäÖÃÎļþÖУº

Group nogroup

ÐÞ¸ÄΪ£º

Group nobody

ÒòΪredhatϵͳÖÐnobodyÓû§ÊôÓÚnobody×飬¶ø²»ÊÇnogroup×é¡£

ÈôÐèÒª½«proftpdÉèÖÃΪϵͳÆô¶¯Ê±×Ô¶¯Æô¶¯Ôòͨ¹ýÈçÏÂÃüÁ±´Æô¶¯Îļþ£º

[root@ftpd proftpd-1.2.0rc3]# cp ./contrib/dist/rpm/proftpd.init.d /etc/rc.d
/init.d/proftpd

È»ºóÐ޸ĸýű¾µÄ¿ÉÖ´ÐÐÊôÐÔ£º

[root@ftpd /]# chmod +x /etc/rc.d/init.d/proftpd

È»ºó±à¼­/etc/rc.d/init.d/functions£º

ÐÞ¸Ä

export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"

Ϊ

export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin"

×¢£ºÈô½«ÔÚÔËÐÐ./cofigureÃüÁîʱͨ¹ý--prefixÑ¡ÏîÖ¸¶¨½«proftpd°²×°ÔÚ/usr/sbinĿ¼ÏÂÔò²»ÐèÒªÐÞ¸ÄfuctionsÎļþ¡£

È»ºóÔËÐÐÃüÁ

[root@ftpd rc3.d]# chkconfig --level 35 proftpd on
ÔòÏ´ÎϵͳÆô¶¯ÒÔºó£¬proftpd½«×Ô¶¯Æô¶¯¡£

×îºó£¬ÐèҪȷ±£ÏµÍ³µ±Ç°Ã»ÓÐftp·þÎñÆ÷ÔÚÔËÐУº

[root@ftpd /]# netstat -ln

ÈôÊä³öÖв»°üº¬

tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN

ÕâÑùµÄÄÚÈÝÔò¿ÉÒÔÖ±½ÓÆô¶¯proftpd£¬·ñÔòÐèÒª¹Ø±ÕÒÔÇ°µÄftpd·þÎñÆ÷¡£¶ÔÓÚÒ»°ãµÄȱʡLinux°²×°À´Ëµ£¬ÔòÐèҪͨ¹ýÒÔϵÄ;¾¶À´¹Ø±Õftp·þÎñÆ÷£º

±à¼­/etc/inetd.confÎļþ£¬ÔÚ

ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a

Ò»ÐÐÇ°¼ÓÉÏ#£º

#ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a

È»ºó£º

[root@ftpd /]# ps ax|grep inetd
350 ? S 0:00 inetd

µÃµ½inetdµÄ½ø³ÌºÅ £¬ÖØÐÂÆô¶¯inetd½ø³Ì£º

[root@ftpd /]# kill -HUP 350

È»ºóͨ¹ýÈçÏÂÃüÁîÆô¶¯proftpd£º

[root@ftpd /]# /etc/rc.d/init.d/proftpd start

Õâʱºò¿ÉÒÔͨ¹ýÈçÏÂÃüÁîÀ´²âÊÔproftpdÊÇ·ñÕý³£ÔËÐУº

C:WINDOWS>ftp 192.168.2.33
Connected to 192.168.2.33.
220 ProFTPD 1.2.0rc3 Server (ProFTPD Default Installation)[ftpd.test.com.cn]
User (192.168.2.33:(none)): ideal
Password:
230 User ideal logged in.
ftp>

ÔòÏÖÔÚÄã¾ÍÓµÓÐÁËÒ»¸ö°²È«¿É¿¿µÄftp·þÎñÆ÷¡£

FAQ

1¡¢ÎÒ°²×°proftpdÒԺ󣬳öÏÖÁËÎÊÌ⣬ÎÒÈçºÎµ÷ÊÔ£¿

ͨ¹ýͨ¹ýÃüÁî/usr/local/sbin/proftpd -d9 -nÆô¶¯proftpdÀ´½øÐе÷ÊÔ,Ôòproftpd¾Í»á½«µ÷ÊÔÐÅÏ¢´òÓ¡µ½consleÉÏÒÔ¹©µ÷ÊÔÖ®Óá£

2¡¢ÎªÊ²Ã´ÎÒµÄproftpfÆô¶¯ÒÔºó£¬ÄäÃûÓû§²»ÄܵǼ£¿

²é¿´proftpÅäÖÃÎļþ/usr/local/etc/proftpd.conf£¬ÐÞ¸ÄΪ£¨ÕâÀï/home/ftp¿ÉÒÔÊÇÈκÎÏ£ÍûÄäÃûÓû§µÇ¼ÒÔºóµÄµ±Ç°¸ùĿ¼£¬µ«ÊÇÈ·±£ÒªÊ¹¸ÃĿ¼ÔÊÐíftpÓû§·ÃÎÊ£©£¬²¢ÇÒÈô²¿·ÖµÄUserÖ¸ÁîÖ¸¶¨µÄÓû§ÎªftpÓû§£¬ÔòÐèÒªÔÚÅäÖÃÎļþÖÐÌí¼ÓÈçÏÂÃüÁîָʾ£º

RequireValidShell off

3¡¢ÎÒÈçºÎʵÏÖÒ»¸öÕý³£Óû§µÇ¼ÒÔºó½«ÆäµÄ·ÃÎÊÏÞ¶¨ÔÚij¸öĿ¼֮Ï£¿
¿ÉÒÔͨ¹ýÖ¸ÁîDefaultRootÀ´ÊµÏÖ¡£ÀýÈçÈôÏ£Íû½«ftpusers×éµÄÓû§ÏÞ¶¨ÔÚ×Ô¼ºµÄhomeĿ¼Ï£¬ÔòÐèÒªÊ×ÏÈ´´½¨¸Ã×飺

/usr/sbin/groupadd ftpusers

È»ºó½«Óû§ideal¼ÓÈëµ½¸Ã×éÖУº

usrmod -G ftpusers ideal

×îºóÔÚÔÚproftpd.confÎļþÖÐÌí¼ÓÈçÏÂÄÚÈÝ£º

DefaultRoot ~ ftpusers

Ò²¿ÉÒÔÏÞÖÆÓû§µÇ¼ÒÔºó½ö½ö·ÃÎÊ×Ô¼ºÖ÷Ŀ¼ÏµÄÒ»¸ö×ÓĿ¼£º

DefaultRoot ~/anoftp ftpusers

µ±È»Ò²¿ÉÒÔ½«Óû§ÏÞÖÆÔÚÆäËûĿ¼֮Ï£¬¶ø²»ÊÇ×Ô¼ºµÄhomeĿ¼Ï£º

DefaultRoot /tmp ftpusers

Ò²¿ÉÒÔÏÞ¶¨Ò»¸öÓû§×éµÄijЩÓû§±»ÏÞÖÆ£¬¶øÆäËû²»×÷ÏÞÖÆ£º

DefaultRoot ~ ftpusers,!empolyee

Õâ¸öÖ¸Áîָʾ½ö½öÏÞÖÆftpusers×éÖеIJ»ÊÇempolyee×éµÄÓû§½øÐÐÏÞÖÆ¡£

4¡¢ÎÒÈçºÎʹÓû§µÇ½ʱ²»ÏÔʾftp·þÎñÆ÷°æ±¾ÐÅÏ¢£¬ÒÔÔöÇ¿°²È«ÐÔ£¿

ÔÚproftpd.confÖÐÌí¼ÓÈçÏÂÄÚÈÝ£º

ServerIdent off

ÔòÔٴεǼʱ£¬ÏÔʾÈçÏÂÄÚÈÝ£º

C:WINDOWS>ftp 192.168.2.33
Connected to 192.168.2.33.
220 ftpd.test.com.cn FTP server ready.
User (192.168.2.33:(none)):

5¡¢ÔÚproftpd»·¾³ÏÂÈçºÎÉ趨ÐéÄâÖ÷»ú£¿

¿ÉÒÔͨ¹ýÖ¸ÁVirtualHostÀ´ÊµÏÖ£¬Ò»¸ö×î¼òµ¥µÄÀý×Ó£º


ServerName "virtual FTP server"

ÈôÄã½ö½öÏ£Íûͨ¹ýÄäÃû·ÃÎÊij¸öÐéÄâÖ÷»ú£¬ÔòʹÓÃÈçϵÄÖ¸Á



ServerName "virtual FTP server"


DenyAll




User private
Group private


AllowAll


ÕâÑù192.168.2.35µÄÕą̂Ö÷»úÔò½ö½öÔÊÐíÄäÃûµÇ¼¡£

±ÊÕßµÄproftpd.confÅäÖÃÎļþÄÚÈÝΪ£º

ÒýÓÃ:
# This is a basic ProFTPD configuration file (rename it to
# proftpd.conf for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName "test.com.cn FTP Server"
ServerType standalone
DefaultServer on

# Port 21 is the standard FTP port.
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022

# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 30


RequireValidShell off
ServerIdent off


# Set the user and group that the server normally runs at.
User nobody
Group nobody

# Normally, we want files to be overwriteable.

AllowOverwrite on


# A basic anonymous configuration, no upload directories.

User ftp
Group ftp
# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp

# Limit the maximum number of anonymous logins
MaxClients 10

# We want welcome.msg displayed at login, and .message displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayFirstChdir .message

# Limit WRITE everywhere in the anonymous chroot

DenyAll

DefaultRoot ~ ftpusers

ServerName "virtual FTP server"

DenyAll

User private
Group private

AllowAl
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 3 ÌõÆÀÂÛ

  1. yibaxiaomai-laj ÓÚ 2013-04-24 09:36:05·¢±í:

    ¿ª¾íÓÐÒ棡

  2. yibaxiaomai-laj ÓÚ 2013-04-24 09:36:03·¢±í:

    ¿ª¾íÓÐÒ棡

  3. 657129880@qq.co ÓÚ 2013-04-21 18:51:37·¢±í:

    лл·ÖÏí£¡£¡£¡