1. pure-ftpd 다운로드 : http://download.pureftpd.org/pub/pure-ftpd/releases/
2. 압축 해제, 컴파일 및 selinux 끄기
1 2 3 4 5 6 7 8 9 |
~]# cd /opt ~]# tar xfzp pure-ftpd-1.0.36.tar.gz ~]# cd pure-ftpd-1.0.36 ~]# ./configure --with-altlog --with-language=english --with-rfc2640 --with-ftpwho --with=tls --without-ldap --without-mysql --without-pgsql ~]# make && make install ~]# setsebool -P ftpd_use_passive_mode on ~]# setsebool -P ftp_home_dir on ~]# setenforce 0 |
3. /etc/pam.d/ftp 설정
1 2 3 4 5 6 7 |
#%PAM-1.0 auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed auth include system-auth auth required pam_shells.so account include system-auth session include system-auth session required pam_loginuid.so |
4. TLS 통신 활성화를 위한 퍼블릭키 생성.
1 2 |
~]# ln -s /etc/pki/tls/certs /etc/ssl/private ~]# openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/pki/tls/certs/pure-ftpd.pem -out /etc/pki/tls/certs/pure-ftpd.pem |
5. /etc/pure-ftpd/pure-ftpd.conf 설정
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
############################################################ # # # Configuration file for pure-ftpd wrappers # # # ############################################################ ChrootEveryone yes BrokenClientsCompatibility no MaxClientsNumber 50 Daemonize yes MaxClientsPerIP 8 DontResolve yes MaxIdleTime 15 UnixAuthentication yes LimitRecursion 10000 8 AnonymousCanCreateDirs no MaxLoad 4 Bind ,21 PassivePortRange 40003 40103 AntiWarez yes AnonymousOnly no NoAnonymous yes AnonymousCantUpload yes MaxDiskUsage 99 Umask 133:022 MinUID 500 UseFtpUsers no AllowUserFXP no AllowAnonymousFXP no AllowDotFiles yes VerboseLog no SyslogFacility ftp PIDFile /var/run/pure-ftpd.pid AltLog w3c:/var/log/xferlog CustomerProof yes TLS 1 FileSystemCharset utf8 ClientCharset cp949 #UserBandwidth 8 #PAMAuthentication yes #UserRatio 1 10 #ForcePassiveIP 192.168.0.1 #TrustedIP 10.1.1.1 #AnonymousRatio 1 10 #AnonymousBandwidth 8 #DisplayDotFiles yes #ProhibitDotFilesWrite yes #ProhibitDotFilesRead yes #LogPID yes #NoChmod yes #KeepAllFiles yes #CreateHomeDir yes #Quota 1000:10 #CallUploadScript yes #NoRename yes #PerUserLimits 3:20 #NoTruncate yes #IPV4Only yes #IPV6Only yes |
36번째줄 설정은 서버 인코딩셋에 따라 euckr 으로 지정해야 할수 있다.
echo $LANG 로 서버 인코딩셋을 확인하거나 /etc/stsconfig/i18n 을 확인하거나 수정 후에 맞추어 준다.
6. pure-ftpd 명령어 생성
1 2 3 |
~]# touch /etc/init.d/pure-ftpd ~]# chmod 700 /etc/init.d/pure-ftpd ~]# vi /etc/init.d/pure-ftpd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
#!/bin/bash # Startup script for the pure-ftpd FTP Server $Revision: 1.1 $ # chkconfig: - 85 15 # description: Pure-FTPd is an FTP server daemon based upon Troll-FTPd # processname: pure-ftpd # pidfile: /var/run/pure-ftpd.pid # config: /etc/pure-ftpd/pure-ftpd.conf # Source function library. . /etc/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is configured. [ ${NETWORKING} = "no" ] && exit 0 RETVAL=0 prog="pure-ftpd" # Path to the pure-ftp binaries. fullpath=/usr/local/sbin/pure-ftpd pureftpwho=/usr/local/sbin/pure-ftpwho pure_config=/etc/pure-ftpd/pure-ftpd.conf pure_launch_script=/usr/local/sbin/pure-config.pl start() { echo -n $"Starting $prog: " daemon "$pure_launch_script $pure_config --daemonize > /dev/null" RETVAL=$? [ $RETVAL = 0 ] && touch /var/lock/subsys/pure-ftpd echo } stop() { echo -n $"Stopping $prog: " killproc pure-ftpd RETVAL=$? [ $RETVAL = 0 ] && rm -f /var/lock/subsys/pure-ftpd echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; reload) echo -n $"Reloading $prog: " killproc pure-ftpd -HUP RETVAL=$? echo ;; condrestart) if [ -f /var/lock/subsys/pure-ftpd ] ; then stop # avoid race sleep 3 start fi ;; status) status pure-ftpd RETVAL=$? if [ -f $pureftpwho ] && [ $RETVAL -eq 0 ] ; then $pureftpwho fi ;; *) echo $"Usage: pure-ftpd {start|stop|restart|reload|condrestart|status}" RETVAL=1 esac exit $RETVAL |
7. 데몬 시작 및 chkconfig 등록.
1 2 |
~]# /etc/init.d/pure-ftpd start ~]# chkconfig --level 2345 pure-ftpd on |