上传到Linux FTP
服务器 /tmp 目录
关闭服务
service ftp
d stop
service iptables stop
chconfig iptables off
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config;
setenforce 0
检查旧版
ftp
d 版本
ftp
d -v
卸载旧版
ftp
d
yum remove -y
ftp
d
安装依赖包:
yum install -y libcap libcap-devel tcp_wrappers tcp_wrappers-devel
编译安装源码包
tar -xzvf
ftp
d-3.0.3.tar.gz
cd
ftp
d-3.0.3
vim builddefs.h
#ifndef VSF_BUILDDEFS_H
#define VSF_BUILDDEFS_H
#define VSF_BUILD_TCPWRAPPERS
#define VSF_BUILD_PAM
#undef VSF_BUILD_SSL
#endif /* VSF_BUILDDEFS_H */
sed -i 's/UTF8 ON/DISABLE UTF8 ON/g' opts.c
make
&&
make
install
mkdir
/etc/ftp
d/
cp
ftp
d.conf /etc/ftp
d/
cp
RedHat/ftp
d.pam /etc/pam.d/ftp
sed
-i
's/lib\//lib64\//g'
/etc/pam.d/ftp
修改配置文件(去掉后面注释)
vi /etc/ftp
d/ftp
d.conf
anonymous_enable=No
local_enable=YES
write_enable=YES
dirmessage_enable=YES
max_clients=100
#listen_port=8080
pasv_min_port=30000
pasv_max_port=30100
local_root=/FTP
chroot_local_user=YES
allow_writeable_chroot=YES
启动并查看ftp
d
/usr/local/sbin/ftp
d
&
netstat
-tunlp |
grep
21
/usr/local/sbin/ftp
d -v
cp
/usr/local/sbin/ftp
d /usr/sbin/ftp
d
制作启动脚本
vim /etc/xinetd.d/ftp
d
disable = yes
vim /etc/init.d/ftp
d
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: ftp
d
# Required-Start: $local_fs $network $named $remote_fs $syslog
# Required-Stop: $local_fs $network $named $remote_fs $syslog
# Short-Description: Very Secure Ftp
Daemon
# Description: ftp
d is a Very Secure FTP
daemon. It was written completely from
# scratch
### END INIT INFO
# ftp
d This shell script takes care of starting and stopping
# standalone ftp
d.
#
# chkconfig: - 60 50
# description: ftp
d is a ftp
daemon, which is the program \
# that answers incoming ftp
service requests.
# processname: ftp
d
# config: /etc/ftp
d/ftp
d.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
RETVAL=0
prog="ftp
d"
start() {
# Start daemons.
if
[ -d /etc
] ;
then
for
i
in
`
ls
/etc/ftp
d/ftp
d.conf`;
do
site=`
basename
$i .conf`
echo
-n $
"Starting $prog for $site: "
/usr/local/sbin/ftp
d
$i &
RETVAL=$?
[ $RETVAL -
eq
0 ] && {
touch
/var/lock/subsys/$prog
success $
"$prog $site"
}
echo
done
else
RETVAL=1
fi
return
$RETVAL
}
stop() {
# Stop daemons.
echo
-n $
"Shutting down $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -
eq
0 ] &&
rm
-f /var/lock/subsys/$prog
return
$RETVAL
}
# See how we were called.
case
"$1"
in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if
[ -f /var/lock/subsys/$prog ];
then
stop
start
RETVAL=$?
fi
;;
status)
status $prog
RETVAL=$?
;;
*)
echo
$
"Usage: $0 {start|stop|restart|condrestart|status}"
exit
1
esac
exit
$RETVAL
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
授权755
chmod
755 /etc/init.d/ftp
d
chkconfig ftp
d on
验证
service ftp
d restart
ftp
d -v
--禁止本地ftp
用户访问操作系统
usermod -s /sbin/nologin ftp
user