tid=21211&參考:0 s! ^7 n6 i, [% \! ~5 V7 Q! T
http://www.111cn.net/sys/CentOS/88456.htm7 z# w* Y+ u. L0 L
https://www.centos.bz/2011/03/centos-pureftpd-install/
1 ]7 t& F S% F& i# e" B. r4 \9 ^! D# \5 o
通过Yum安装Pure-ftpd的详细步骤如下:
; ]6 ^; R3 N% d. _/ Z) X1 B& b9 _
步骤一:配置yum源以下是針對 CentOS 6.X
/ I+ }6 z: s) e$ Q9 F! t备份(如有配置其他epel源)
5 S4 T1 I' h% Z. m. L4 omv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup3 @6 h( N+ d$ Y7 v# `3 I2 e
下载新repo 到/etc/yum.repos.d/
$ e6 |: b( g$ l: `- j( Cwget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo$ r5 i% f' N9 ^0 j
yum makecache
, X9 t# N- J- }% c, A! \
0 @) y& D2 V8 Z# B1 }以下是針對 CentOS 5.X
1 ]" [. W4 X3 f" k. e* _0 Xcd /etc/yum.repos.d/
6 M4 _: c9 C1 H( Z- Zwget http://centos.karan.org/kbsingh-CentOS-Extras.repo
) A* z5 T5 Y5 z L/ H6 Q
W7 ^) u; t$ M& Z1 n/ h必需激活kbs-CentOS-Testing庫。打開kbsingh-CentOS-Extras.repo文件,把enabled=0改成enabled=1。! Z, ~! y0 F0 v1 r( ~9 f
vi kbsingh-CentOS-Extras.repo. f7 d! r$ n* X% m
- [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
複製代碼 如果步驟一失敗的話,使用以下指令:
: D# T8 O6 x3 ~5 w4 yrpm -Uvh ftp://ftp.trychlos.org/pub/CentOS/6.3/pcalfs/x86_64/RPMS/epel-release-6-7.noarch.rpm (CentOS 6.7)6 L9 A) g) h$ ^5 ~' U0 w) B; q
上列是以CentOS 6.7,假如是CentOS 6.8 則在google 搜尋 epel-release-6-8.noarch.rpm的載點,以此類推, p9 A7 Q9 g+ C' c
; \& \% a D( b" ~$ S8 _. x( q! K! o
步骤二:yum安装
( N# X% u J9 g& j l/ V8 nyum install pure-ftpd -y9 \. V/ N# T) ^8 o
- y6 F- C2 o0 o$ z
步骤三:修改配置文件
0 F7 P/ q& k' B' v- o( E Cvim /etc/pure-ftpd/pure-ftpd.conf6 A# b& |4 L) l5 N, I2 [
# n5 ~: A5 {; V- t, {' U* U
PureDB /etc/pure-ftpd/pureftpd.pdb
5 k% A" H4 S' W# b/ Y8 o0 W! U#去掉这行注释,指定路径,PureDB用户数据库文件
; _, H. M" a1 R9 [: LVerboseLog yes# j3 i6 m: |$ u
#开启日志 /var/log/pureftpd.log
+ ]0 p) A9 Z. [: l d9 q* T" }( sNoAnonymous yes
- ^' L: Z7 J# k V#拒绝匿名用户登录7 W! [. K& l9 w: f* _4 m# G4 ]
PassivePortRange 48000 50000
# B4 j4 ?, [/ x: K. @; n& Z$ n#使用被动模式,限制端口。
0 k6 b+ f' a' D& F _# ?1 I5 K! ]) a1 S
* J0 `$ g( s, D& f; R
) e& }3 @' o) {' y步骤四:配置防火墙策略
F% A2 g/ B4 H8 O9 j, viptables -A INPUT -p tcp --dport 21 -j ACCEPT
8 u& R$ Z, x6 J( ~: [& t/ _# Riptables -A INPUT -p tcp --dport 48000:50000 -j ACCEPT
G) U' w8 G& U3 X- F4 U1 f2 ?2 g6 B, C" J
步骤五:启动pure-ftpd0 B# N, |6 P% f0 }" H6 @2 r8 ^9 w. b
chkconfig pure-ftpd --level 345 on (設定每次開機自動執行)
" s6 v: s# M' K) K! Z假如找不到chkconfig,which chkconfig 可以找到它的目錄位置,一般應該在/sbin,如果/sbin也沒有則表示沒安裝chkconfig
) ]$ T) f: M. v! r% s# Z( C4 wyum install chkconfig 安裝chkconfig
) D9 u z3 ?, c- \% \' Z0 A假如安裝完也 chkconfig: command not found
6 X+ ~0 T) [2 z: h3 b則做一個連結 6 e0 ^ a a, v: {: E# _: I
ln -s /sbin/chkconfig /usr/bin/
, ]( X9 b) g+ K0 ~% c; z4 C1 w U1 _8 ^+ V
/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 found
! O. y# e5 T5 [% P% s. q8 @也作一個連結, o# j8 _0 C$ F* l, n! i
ln -s /sbin/service /usr/bin/
# p ~9 P) {- l: `
) u6 s+ |( D4 u, O$ C) h7 ]安裝 ftp client :& E# w# a6 f( M3 p+ m
yum install ftp -y/ r; h$ L+ \3 W) o0 k
& [* O; J8 [$ K* B8 W6 C註:+ V- q7 F9 g, q( |
$ s3 S, T& V3 `9 _1.
( e3 Z# _/ I5 o7 lwhen login ftp show error:. L- l Y% b& b( X" H6 N2 w
530 Login authentication failed
. u/ d( d9 c3 c# ~1 S6 b8 BLogin failed.* E, x, o3 z2 c8 j
$ [! e9 Z8 V" ^( k* |
7 I f; S% U# ]7 r( V8 U' Hcheck /var/log/secure) g9 f! {8 F3 G
Nov 3 10:03:44 DLTB-2475 pure-ftpd: pam_listfile(pure-ftpd:auth): Couldn't open /etc/ftpusers
; ~7 |; V u3 W: oNov 3 10:03:44 DLTB-2475 pure-ftpd: PAM audit_log_acct_message() failed: Operation not permitted
7 h0 o8 Z O' r g( E* m% n* v8 |. `7 r
Sol:) c' D( X. k7 B, |
vi /etc/pure-ftpd/pure-ftpd.conf
! C2 [& l( k/ T; n# q! {/ Y將PAMAuthentication 認證改成 UnixAuthentication認證 ,即
, Q* R& b6 q) G2 z$ b#PAMAuthentication yes 註解掉3 A3 {* ]& e0 L+ E* E7 ^0 w
UnixAuthentication yes 取消註解" `: ~# Z, Q* ?1 h+ w5 H
service pure-ftpd restart8 z P8 h4 M+ p: B, |" M
+ Z! P v/ u$ z `4 b* k# w- @2.) E3 E- m) A9 N/ k+ m7 ^( q6 i6 d! Z. c
When login ftp server from remote host show errors:
$ V2 Z- E" M0 K1 s+ Zconnect: No route to host
6 _! i8 H# N' a原因是防火牆擋住了,或iptable没有預設NAT處理,SOL:
. D/ N+ h. x% k9 T, ostop iptables or 適當設定 iptables
9 C6 c0 I( m- z+ z或
# F. C2 y/ u X$ S/ Ivi /etc/sysconfig/iptables-config# W5 a9 i: o* l( l
更改 IPTABLES_MODULES=”” 為 IPTABLES_MODULES=”ip_nat_ftp ip_conntrack_ftp”
# N& a; [( M/ o8 \8 V1 _service iptables reload
3 i' r, v0 a3 p) x2 C; c X
4 ^; C' o+ b: _! }1 a3./ G3 ]1 z, [( C+ A
421 Unable to read the indexed puredb file (or old format detected) - Try pure-pw mkdb6 ]% R+ V1 g9 ]5 j$ l) _ f
Login failed.
7 u9 y: f4 S: Y- {' W( @# K7 v1 r3 m" |) S
SOL:9 v d% y( b, ~4 A8 x# i
vi /etc/pure-ftpd/pure-ftpd.conf0 k# y/ g: E- W) T9 a) b
將 PureDB /etc/pure-ftpd/pureftpd.pdb 註解掉0 H& m5 c& @, K
4.* o% A4 J; q# R6 j( Y+ `
ftp> put file
& i) a7 ?$ V7 I# ilocal: file remote: file* s8 k" a9 n- j. _. D% P* a
227 Entering Passive Mode (122,117,11,31,193,78)8 ?0 }4 G" u# j0 N' t
553 Can't open that file: Permission denied5 B% A) X1 }/ a7 ~. q" A; C
, \: d# y Q- D% c$ u
SOL:, ~2 x2 u- h" L) H! p O1 p
ls -l /home/user1
# F3 @, a2 q" o: e7 _ B& J$ kdrwxr-xr-x. 2 root root 4096 2016-01-17 04:46 user1
% j! e, F4 B$ I: S4 J; [) ychown user1:user1 /home/user1
- o; ]9 ]. f9 E3 g# J% J- ^$ o- `; r+ c8 T2 o9 W
[ftp 指令]
2 ~: J+ s# R+ l& w* @% i* slcd 改變local目錄/ f8 ]* [3 B0 j& S* |
lls 查看local目錄或檔案 (等同 !ls)" R) X- y# N0 u: P
, p+ E1 P6 K3 O+ B3 L# Q: i
1 u2 o( e7 z( t) u/ b% w( h/ o; Z
2 o9 y% o$ }. S {- @0 `' P/ i8 R9 L* m' F) G- P6 K* @+ b
|