tid=21211&參考:
6 `7 y2 l5 G2 chttp://www.111cn.net/sys/CentOS/88456.htm
3 J' i) p# @ u, [3 x! Zhttps://www.centos.bz/2011/03/centos-pureftpd-install/4 P% i( R# Q5 z4 t7 L; c
) N3 \/ Q! z* j5 U$ C通过Yum安装Pure-ftpd的详细步骤如下:! G) D. [' z* }- D
- l T, p# Z1 E; F" ]. q* T. e
步骤一:配置yum源以下是針對 CentOS 6.X% P/ i' Z% K) v
备份(如有配置其他epel源)7 W0 k9 `# b& m5 C# c6 _
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup& `9 R- W9 [' t) c1 t" u
下载新repo 到/etc/yum.repos.d/
& K, Y/ E# s% y4 Dwget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
; x% r1 K) T$ Q; N. G+ G: ~2 Wyum makecache& b ~9 _6 q: Z6 U( K2 G/ w& h
3 L8 E( Y/ j! P
以下是針對 CentOS 5.X6 x( }( L$ P. s9 }. @- k
cd /etc/yum.repos.d/. w( f) g8 N- S1 j' w' L
wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
+ `0 h% D4 e3 `% u. Q& o6 l. D; \2 F0 M
必需激活kbs-CentOS-Testing庫。打開kbsingh-CentOS-Extras.repo文件,把enabled=0改成enabled=1。
- F ~& L* _ v3 s$ f- ovi kbsingh-CentOS-Extras.repo
! Q$ C$ D0 ^2 F s- [kbs-CentOS-Testing]
- name=CentOS.Karan.Org-EL$releasever - Testing
- gpgcheck=1
- gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
- enabled=1
- baseurl=http://centos.karan.org/el$releasever/extras/testing/$basearch/RPMS/
複製代碼 接着我們導入GPG key到軟件庫- rpm --import http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
複製代碼 如果步驟一失敗的話,使用以下指令:
- W3 ?8 I# M3 \4 k, \: G% c- Drpm -Uvh ftp://ftp.trychlos.org/pub/CentOS/6.3/pcalfs/x86_64/RPMS/epel-release-6-7.noarch.rpm (CentOS 6.7)/ A7 }+ Y$ @6 ]$ Z6 e
上列是以CentOS 6.7,假如是CentOS 6.8 則在google 搜尋 epel-release-6-8.noarch.rpm的載點,以此類推; F: d0 f" K- @ K
" J/ f8 J' F7 r1 K1 f9 [
步骤二:yum安装
2 q& B; j! G' o5 G kyum install pure-ftpd -y( h- s+ K: M5 L: U% L
" B! k3 C4 i" R, N( I; y" f* E步骤三:修改配置文件6 ]& @! a" Z% |6 w0 {3 c: C% ?
vim /etc/pure-ftpd/pure-ftpd.conf
# O2 b# b. C2 m0 _. Q( A+ b. ~( X
PureDB /etc/pure-ftpd/pureftpd.pdb
+ H+ E1 }9 Z4 [! h#去掉这行注释,指定路径,PureDB用户数据库文件8 B% @( d @% F9 S1 ~: Q1 e- v
VerboseLog yes
( q- T6 A5 F" f& i4 ~, }& ~#开启日志 /var/log/pureftpd.log
8 ?2 O8 G* _* K6 p: zNoAnonymous yes
1 x$ t* f" n' c" r#拒绝匿名用户登录
6 G; ~: S% J1 o" sPassivePortRange 48000 50000
: o, h1 c y0 P7 S#使用被动模式,限制端口。2 U4 W: D' x+ z3 _5 [
0 d5 f( t0 _, N U6 d; I3 Q, N
5 }; K8 \# Y; D5 f! i0 A0 S: w' h* ^/ g
步骤四:配置防火墙策略
x! j a3 Z) |7 j+ h1 Riptables -A INPUT -p tcp --dport 21 -j ACCEPT( ^9 ?; c) ?- ~6 f% X' P1 }7 N; l- _
iptables -A INPUT -p tcp --dport 48000:50000 -j ACCEPT: x8 D2 I& c2 Y
, l; ]1 M# \3 E8 M2 C& Q/ i步骤五:启动pure-ftpd
+ S$ ~/ v8 ?8 X. g, i" a+ o# A4 schkconfig pure-ftpd --level 345 on (設定每次開機自動執行)
6 F1 Z s; N+ q3 {. c/ b$ u5 I4 B E假如找不到chkconfig,which chkconfig 可以找到它的目錄位置,一般應該在/sbin,如果/sbin也沒有則表示沒安裝chkconfig# n5 @8 B! X& |. S: Q- Q$ |
yum install chkconfig 安裝chkconfig
* x/ S" [7 W+ W假如安裝完也 chkconfig: command not found. A3 s2 a7 e% h! r: ^
則做一個連結 5 F. q g; F/ S& W$ ~, s$ Z% e
ln -s /sbin/chkconfig /usr/bin/3 \+ ~$ L8 q1 ?3 p
, v9 s2 i& A' @! U- q% B/etc/init.d/pure-ftpd start 或 service pure-ftpd start使用源碼安裝請參考 http://www.111cn.net/sys/CentOS/88456.htm假如 service pure-ftpd start 也顯示 service: command not found8 k- R# Z" C P$ q3 a3 f
也作一個連結
: D* |4 U- r$ J7 R' E" oln -s /sbin/service /usr/bin/
' z( J2 E5 k0 Q4 k$ Q
, H+ \+ Q3 d1 N安裝 ftp client :
2 K7 D0 g# M! cyum install ftp -y
7 P0 y$ q7 ]# Q; q j1 D8 v y4 _& x8 s
註:- @- q% F* k1 U; V3 D, T
; G. f9 |) `. _1.
* Z+ ~& i! K: x7 w% c6 B, Bwhen login ftp show error:
& w% F8 A' r1 Q% R" d530 Login authentication failed
4 Y( B, y8 y0 N) `5 K" r9 qLogin failed.
( c+ K- H* {5 u) j4 E; r* e4 \, C* N
! |) b5 P9 S- Ncheck /var/log/secure) \6 E0 x2 }, t, v& D9 g/ j
Nov 3 10:03:44 DLTB-2475 pure-ftpd: pam_listfile(pure-ftpd:auth): Couldn't open /etc/ftpusers8 A- |3 }2 {" R0 x
Nov 3 10:03:44 DLTB-2475 pure-ftpd: PAM audit_log_acct_message() failed: Operation not permitted
+ {. h, Q/ @4 W4 h$ Z. {. m! e3 n# }1 H
Sol:! y; U) a m; U" u
vi /etc/pure-ftpd/pure-ftpd.conf) i" ~8 E" ^" I7 }& L+ ?$ X5 @4 H
將PAMAuthentication 認證改成 UnixAuthentication認證 ,即
/ ?, L/ R% }: l, j#PAMAuthentication yes 註解掉6 W8 U. u, J6 x% b
UnixAuthentication yes 取消註解
" c- ?" s, q: |8 P) i* `service pure-ftpd restart
. B6 Z6 s4 V% i4 |
% V0 \: M% r9 j% L% j2.' [6 J, y2 R4 Y/ B) L$ ~3 o/ X
When login ftp server from remote host show errors:
W- F, G7 }6 x- p" Nconnect: No route to host
( A0 C; W' a6 i原因是防火牆擋住了,或iptable没有預設NAT處理,SOL:
$ U! V! s/ q) G. l( vstop iptables or 適當設定 iptables
: Z% V6 V5 T9 |( }" e) _( }或
% v4 z+ T! H. wvi /etc/sysconfig/iptables-config: t( K4 {' t" c, S* M
更改 IPTABLES_MODULES=”” 為 IPTABLES_MODULES=”ip_nat_ftp ip_conntrack_ftp”( S( ?" ]( Y" r6 Q7 e( D+ X
service iptables reload
9 j7 X6 V6 x$ j+ a7 l, R( m0 d5 e! Q4 E; |1 C5 T! F
3., @- ]7 i! I* t$ s/ ~+ a# ~
421 Unable to read the indexed puredb file (or old format detected) - Try pure-pw mkdb! D5 h9 |) m% t" p# I4 f
Login failed.! |7 T' V! w8 h- Z
- h2 W8 j; ?0 U* @' T4 e# A) ]SOL:8 i( ?% K5 l( s# d/ c
vi /etc/pure-ftpd/pure-ftpd.conf
& y% c, B3 J' {- k1 D4 \- S- {- i8 ?* [將 PureDB /etc/pure-ftpd/pureftpd.pdb 註解掉 X; c2 q8 m* Z$ U' T" ]& j
4.
4 D! m, g q% }6 g& f/ S1 yftp> put file
1 S% m' T, h6 k1 _% R5 u! t2 flocal: file remote: file
' @. ?# `' F, E2 D8 D227 Entering Passive Mode (122,117,11,31,193,78)
! P6 g3 |$ y3 u! |- g6 A9 E553 Can't open that file: Permission denied; p* E6 j. U4 x7 o+ U
6 V. w5 T Z! [9 X) TSOL:$ U+ Z' S: \9 i9 V1 v
ls -l /home/user1
. _ k' @/ J8 ndrwxr-xr-x. 2 root root 4096 2016-01-17 04:46 user1! Y' m* z/ o% a5 t n: P
chown user1:user1 /home/user1( f r- z/ j* K
& O- w$ A) {) ?0 X6 |% a6 a0 l
[ftp 指令]
: u/ ]* |" H0 `4 q& | h. clcd 改變local目錄3 d5 \/ N; v5 X4 @& f" e, |
lls 查看local目錄或檔案 (等同 !ls)! Y2 Q: h" U! _( d' a% r p% M" Y
, \" P9 |$ G, z% e
2 c* H+ q9 t" q' x @8 {8 }) ]# S$ t+ _# ?3 Z
7 M& f/ V$ S4 m9 @ |