linux vsftpd 升级步骤

vsftp 最新version下载地址:https://security.appspot.com/vsftpd.html#download


上传到Linux FTP服务器 /tmp 目录


关闭服务
service vsftpd stop
service iptables stop
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config;


检查旧版vsftpd 版本
vsftpd -v


卸载旧版vsftpd
yum remove -y vsftpd


安装依赖包:
 yum install -y libcap  libcap-devel tcp_wrappers  tcp_wrappers-devel


编译安装源码包
tar -xzvf vsftpd-3.0.3.tar.gz 
cd vsftpd-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/vsftpd/
cp vsftpd.conf /etc/vsftpd/       #配置文件     
cp RedHat/vsftpd.pam /etc/pam.d/ftp #PAM认证文件
sed -i 's/lib\//lib64\//g' /etc/pam.d/ftp


修改配置文件
vi /etc/vsftpd/vsftpd.conf
anonymous_enable=No #不允许匿名用户使用  
local_enable=YES  #允许本地用户可用 
write_enable=YES  #写操作  
dirmessage_enable=YES  #需要显示某目录下文件信息
max_clients=100  #FTP服务器最大承载用户数 
#listen_port=8080    #更改监听端口9000 默认是21
#改被动模式
pasv_min_port=30000
pasv_max_port=30100
local_root=/FTP             #修改FTP根目录为/FTP
chroot_local_user=YES       #禁止切换出FTP根目录


启动并查看vsftpd
/usr/local/sbin/vsftpd &
netstat -tunlp | grep 21
/usr/local/sbin/vsftpd -v
cp /usr/local/sbin/vsftpd /usr/sbin/vsftpd


制作启动脚本
vim /etc/xinetd.d/vsftpd
disable                 = yes


vim  /etc/init.d/vsftpd
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: vsftpd
# 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: vsftpd is a Very Secure FTP daemon. It was written completely from
#              scratch
### END INIT INFO


# vsftpd      This shell script takes care of starting and stopping
#             standalone vsftpd.
#
# chkconfig: - 60 50
# description: Vsftpd is a ftp daemon, which is the program \
#              that answers incoming ftp service requests.
# processname: vsftpd
# config: /etc/vsftpd/vsftpd.conf


# Source function library.
. /etc/rc.d/init.d/functions


# Source networking configuration.
. /etc/sysconfig/network


RETVAL=0
prog="vsftpd"
start() {
        # Start daemons.
        if [ -d /etc ] ; then
                for i in `ls /etc/vsftpd/vsftpd.conf`; do
                        site=`basename $i .conf`
                        echo -n $"Starting $prog for $site: "
                        /usr/local/sbin/vsftpd $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/vsftpd
chkconfig vsftpd on


验证
service vsftpd restart
vsftpd -v

你可能感兴趣的:(linux vsftpd 升级步骤)