proftpd安裝文檔----ftp虛擬用戶
proftpd安裝文檔ftp虛擬用戶
http://www.proftpd.org/
作者:linuxpf
注:此文檔proftpd安裝入門參考資料,也為本人學習總結,文中參考網路中部分資料,如有不對請指點,歡迎大家一同交流
qq群:19180048
源碼軟體包:proftpd是開源自由軟體,目前最新穩定版本為1.3.1,注proftpd1.3.1安裝與1.2.X配置文件語法有些不同
平台:centos4.6
一:RPM安裝,其實圖方便採用rpm效果並不差,關健於實用性強,穩定性好
#wget ftp://194.199.20.114/linux/dag/redhat/el4/en/i386/dag/RPMS/proftpd-1.3.1-1.el4.rf.i386.rpm
#wget http://www.castaglia.org/proftpd/contrib/ftpasswd
#cp ftpasswd /sbin/bin
#chmod +x ftpasswd
#rpm -ivh proftpd-1.3.1-1.el4.rf.i386.rpm
修改配置文件:
#cd /home/proftpd/etc/
#cp proftpd.conf proftpd.conf-dist
#vi proftpd.conf
----------------------------------------------------------------
"proftpd.conf" 155L, 4484C
# This is the ProFTPD configuration file
# $Id: proftpd.conf,v 1.1 2004/02/26 17:54:30 thias Exp $
ServerName "The ProFTPD server"
ServerIdent on "FTP Server ready."
ServerAdmin rot@localhost
ServerType standalone
#ServerType inetd
DefaultServer on
AccessGrantMsg "User %u logged in."
#DisplayConnect /etc/ftpissue
#DisplayLogin /etc/ftpmotd
#DisplayGoAway /etc/ftpgoaway
DeferWelcome off
# Use this to excude users from the chroot
#DefaultRoot ~ !adm
DefaultRoot ~
# Use pam to authenticate (default) and be authoritative
AuthPAM on
AuthPAMConfig proftpd
AuthOrder mod_auth_pam.c* mod_auth_file.c
AuthUserFile /etc/proftpd/ftpd.passwd
AuthGroupFile /etc/proftpd/ftpd.group
RequireValidShell off
# Do not perform ident nor DNS lookups (hangs when the port is filtered)
IdentLookups off
UseReverseDNS off
# 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
# Default to show dot files in directory listings
ListOptions "-a"
# See Configuration.html for these (here are the default values)
#MultilineRFC2228 off
RootLogin off
#LoginPasswordPrompt on
MaxLoginAttempts 6
#MaxClientsPerHost none
#AllowForeignAddress off # For FXP
# Allow to resume not only the downloads but the uploads too
AllowRetrieveRestart on
AllowStoreRestart on
# 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 10
# Set the user and group that the server normally runs at.
User nobody
Group nobody
# Disable sendfile by default since it breaks displaying the download speeds in
# ftptop and ftpwho
UseSendfile no
# This is where we want to put the pid file
ScoreboardFile /var/run/proftpd.score
# Normally, we want users to do a few things.
# Define the log formats
LogFormat default "%h %l %u %t \"%r\" %s %b"
LogFormat auth "%v [%P] %h %t \"%r\" %s"
# TLS
# Explained at http://www.castaglia.org/proftpd/modules/mod_tls.html
#TLSEngine on
#TLSRequired on
#TLSRSACertificateFile /etc/pki/tls/certs/proftpd.pem
#TLSRSACertificateKeyFile /etc/pki/tls/certs/proftpd.pem
#TLSCipherSuite ALL:!ADH:!DES
#TLSOptions NoCertRequest
#TLSVerifyClient off
##TLSRenegotiate ctrl 3600 data 512000 required off timeout 300
#TLSLog /var/log/proftpd/tls.log
# SQL authentication Dynamic Shared Object (DSO) loading
# See README.DSO and howto/DSO.html for more details.
#
# A basic anonymous configuration, with an upload directory.
#
---------------------------------------------------------------------------------
參數說明:
DefaultRoot ~ //默認ftp用戶主目錄
ServerType standalone //ftp啟動方式,支持守護進程,和xinetd模式
AuthPAM on //PAM認證支持啟用
AuthPAMConfig proftpd
AuthOrder mod_auth_pam.c* mod_auth_file.c //啟用認證方式
AuthUserFile /etc/proftpd/ftpd.passwd //ftp用戶密碼文件
AuthGroupFile /etc/proftpd/ftpd.group
User nobody //啟動proftpd用戶,為了安全起見
Group nobody
MaxInstances 10 //最大用戶數,防止DDOS
#chkconfig --add proftpd
#chkconfig proftpd on
#service proftpd restart
建立虛擬用戶,脫離於系統用戶,安全性增加了許多:
# mkdir -p /etc/proftpd
# ftpasswd --passwd --file=/etc/proftpd/ftpd.passwd --name=ftpadmin --uid=99 --home=/home/ftpdata --shell=/sbin/nologin
# ftpasswd --group --file=/etc/proftpd/ftpd.group --name=admin --gid=99
# ftpasswd --group --name=admin --gid=99 --member=ftpadmin
註腳:
–passwd指定建立一個新的虛擬用戶,–group則建立一個虛擬組;
–file指定存儲虛擬用戶的文件;
–name指定此虛擬用戶的用戶名,密碼會在命令執行時要求輸入;
–uid指定此虛擬用戶對應的系統用戶UID,此虛擬用戶將以此系統UID的身份讀寫文件
–home指定此虛擬用戶的根目錄,就是其登陸FTP后的根目錄;
–shell指定此虛擬用戶的shell,為了安全當然指定一個不可登陸的shell了。
用戶許可權指派,建議採用方法1,以免引起不必在的麻煩,Linux上POSIX 許可權管理並不是所有人都熟悉
Linux上POSIX 許可權管理相關知識參考:
http://www.linuxpf.com.cn/bbs/viewthread.php?tid=402&extra=page%3D1
方法1:
uid指定此虛擬用戶對應的系統用戶UID,此虛擬用戶將以此系統UID的身份讀寫文件;
#chown -R nobody.root /home/ftpdata/
nobody uid 99,對用戶主目錄賦予所有許可權
關於許可權顆粒化設置:請使用Limit
以下設置ftpadmin所有許可權,並禁止其它人訪問
[火星人 ] 輕鬆proftpd虛擬用戶已經有832次圍觀