安裝配置ProFTPd
1 下載proftpd
地址:www.proftpd.org。這里我們下載了1.2.9版本
[code:1:de92f96787] wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.9.tar.gz
[/code:1:de92f96787]
2 安裝proftpd
切換到下載目錄,假設(shè)為/tmp/proftpd,然后
[code:1:de92f96787] tar zxvf proftpd-1.2.9.tar.gz //解壓
- cd proftpd-1.2.9
- ./configure --prefix=/var/proftpd --sysconfdir=/etc //設(shè)置安裝目錄/var/proftpd,配置文件目錄/etc
- make
- make install
- [/code:1:de92f96787]
3 新建ftp專用帳號(hào)
就是上面目的中提到的那個(gè)專用帳號(hào),這里以skate/skate(u/p)為例。
[code:1:de92f96787] groupadd skate
useradd skate -g skate -d /var/ftp -s /sbin/nologin //設(shè)置/var/ftp目錄為ftp的目錄
passwd skate //設(shè)置skate用戶的密碼
mkdir /var/ftp/upload
chown skate.skate /var/ftp/upload //設(shè)置upload目錄skate用戶可寫
[/code:1:de92f96787]
4 設(shè)置proftpd
proftpd的配置文件就一個(gè),就是/etc/proftpd.conf
[code:1:de92f96787] vi /etc/proftpd.conf //打開proftpd.conf
[/code:1:de92f96787]
[code:1:de92f96787]
####具體配置如下######
ServerName "Test ftp server..."
ServerType standalone
DefaultServer on
#端口
Port 21
Umask 022
#最大線程數(shù)
MaxInstances 30
User skate
Group skate
#DNS反查
UseReverseDNS off
IdentLookups off
#最大嘗試連接次數(shù)
MaxLoginAttempts 3
#每用戶線程
MaxClientsPerHost 2
#最大用戶數(shù)
MaxClients 20
DirFakeUser On skate
DirFakeGroup On skate
DeferWelcome On
#日志文件位置
SystemLog /var/log/proftpd.log
ServerIdent off
#限制skate組的skate用戶登錄時(shí)不能切換到其他目錄(只能呆在他的home目錄)
DefaultRoot ~ skate,skate
#設(shè)置只允許192.168.0的用戶登錄
#
#Order allow,deny
#Allow from 192.168.0.
#Deny from all
#
#設(shè)置只允許skate用戶登錄,否則系統(tǒng)用戶也可以登錄ftp
#
#Order allow,deny
#DenyUser !skate
#
#開起全盤的寫權(quán)限
AllowOverwrite on
AllowStoreRestart on
#允許FXP
# AllowForeignAddress on
AllowAll
#設(shè)置skate用戶在upload的限制
#DELE刪除權(quán)限
#RNFR RNTO重命名權(quán)限
#RMD XRMD移動(dòng)目錄權(quán)限
DenyUser skate
#####結(jié)束######
[/code:1:de92f96787]
編輯完以后按Esc,然后輸入:x保存。
5 啟動(dòng)ProFTPd服務(wù)
編輯一個(gè)啟動(dòng)腳本(這個(gè)是從網(wǎng)上copy的,不是我寫的,感謝那個(gè)寫這個(gè)腳本的人,很好用,thx)
- [code:1:de92f96787] vi /etc/rc.d/init.d/proftpd[/code:1:de92f96787]
- [code:1:de92f96787]
- #####腳本內(nèi)容開始########
- #!/bin/sh
- #
- # Startup script for ProFTPD
- #
- # chkconfig: 345 85 15
- # description: ProFTPD is an enhanced FTP server with \
- # a focus toward simplicity, security, and ease of configuration. \
- # It features a very Apache-like configuration syntax, \
- # and a highly customizable server infrastructure, \
- # including support for multiple 'virtual' FTP servers, \
- # anonymous FTP, and permission-based directory visibility.
- # processname: proftpd
- # config: /etc/proftpd.conf
- #
- # By: Osman Elliyasa
- # $Id: proftpd.init.d,v 1.7 2002/12/07 21:50:27 jwm Exp $
- # Source function library.
- . /etc/rc.d/init.d/functions
- if [ -f /etc/sysconfig/proftpd ]; then
- . /etc/sysconfig/proftpd
- fi
- #下面這行設(shè)置環(huán)境變量,注意設(shè)置好你的proftpd的安裝目錄
- PATH="$PATH:/usr/local/sbin:/var/proftpd/bin:/var/proftpd/sbin"
- # See how we were called.
- case "$1" in
- start)
- echo -n "Starting proftpd: "
- daemon proftpd $OPTIONS
- echo
- touch /var/lock/subsys/proftpd
- ;;
- stop)
- echo -n "Shutting down proftpd: "
- killproc proftpd
- echo
- rm -f /var/lock/subsys/proftpd
- ;;
- status)
- status proftpd
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- reread)
- echo -n "Re-reading proftpd config: "
- killproc proftpd -HUP
- echo
- ;;
- suspend)
- hash ftpshut >/dev/null 2>&1
- if [ $? = 0 ]; then
- if [ $# -gt 1 ]; then
- shift
- echo -n "Suspending with '$*' "
- ftpshut $*
- else
- echo -n "Suspending NOW "
- ftpshut now "Maintanance in progress"
- fi
- else
- echo -n "No way to suspend "
- fi
- echo
- ;;
- resume)
- if [ -f /etc/shutmsg ]; then
- echo -n "Allowing sessions again "
- rm -f /etc/shutmsg
- else
- echo -n "Was not suspended "
- fi
- echo
- ;;
- *)
- echo -n "Usage: $0 {start|stop|restart|status|reread|resume"
- hash ftpshut
- if [ $? = 1 ]; then
- echo '}'
- else
- echo '|suspend}'
- echo 'suspend accepts additional arguments which are passed to ftpshut(8)'
- fi
- exit 1
- esac
- if [ $# -gt 1 ]; then
- shift
- $0 $*
- fi
- exit 0
#######腳本結(jié)束#########
[/code:1:de92f96787]
按Esc,輸入:x保存。
然后添加到系統(tǒng)服務(wù)并啟動(dòng)
[code:1:de92f96787]
chkconfig --add profptd
service proftpd start[/code:1:de92f96787]
以后可以用service proftpd restart來(lái)重起proftpd。
6 ProFTPd的一點(diǎn)體會(huì)
看proftpd的文檔翻譯過的一句話:Finally, a special command is allowed which can be used to control login access: LOGIN Connection or login to
the server. Applying a to this pseudo-command can be used to allow or deny initial connection or login to the context. It has no
effect, and is ignored, when used in a context other than server config, or (i.e. using it in a context
is meaningless).
翻譯下:最后,有一個(gè)用來(lái)限制登陸的特殊命令,就是LOGIN。在中用這個(gè),可以禁止或者允許連接進(jìn)來(lái)。但是,如果不在Server config,
或者中使用的話,他將失去效用,或者說被忽略掉(比如在中使用就是無(wú)效的)。
proftpd感覺還是比vsftp功能配置上好用一點(diǎn),主要掌握好段基本上應(yīng)用來(lái)說就沒有問題了。
【編輯推薦】