编译安装vsftpd

首先下载源码包(我一般喜欢放在/home/test)

解压:tar -zxvf vsftpd-3.0.2.tar.gz

进入目录进行编译

cd vsftpd-3.0.2

编译之前记得gcc c++已经安装(低级错误)还有几个依赖yum一下呗

yum install libcap  tcp_wrappers  tcp_wrappers_devel

编译安装

make && make install

编译安装成功,启动文件在/usr/local/sbin

然后就到配置文件

新建目录

mkdir -p /etc/vsftpd

新建配置文件vsftpd.conf或者把源码的配置文件cp过来

touch /etc/vsftpd/vsftpd.conf
cp /home/test/vsftpd-3.0.2/vsftpd.conf /etc/vsftpd/

新建启动脚本(没有也可以,可以目录启动)把脚本扔进/etc/init.d/下

#!/bin/bash
#
# 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.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x /usr/local/sbin/vsftpd ] || exit 0
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

授予执行权

chmod +x vsftpd

加入服务

chkconfig --add vsftpd

开机启动

chkconfig vsftpd on

或者

chkconfig vsftpd 2345 on

下面是/etc/vsftpd/下的文件

chroot_list  vsftpd.conf  vsftpd.conf_bck  vuser_conf  vuser_passwd.db  vuser_passwd.txt  welcome.txt

首先配置vsftpd.conf

anonymous_enable=NO

local_enable=YES

local_root=/home/test

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd/chroot_list

ascii_upload_enable=YES
ascii_download_enable=YES pam_service_name=vsftpd guest_enable=YES
guest_username=ftpadmin user_config_dir=/etc/vsftpd/vuser_conf
allow_writeable_chroot=YES banner_file=/etc/vsftpd/welcome.txt

接着chroot_list

test1
ftpadmin
vsftpd

然后welcome.txt

Hello, Welcome to vsftpd !!

跟着vuser_passwd.txt

test
test
test1
test1
test2
test2

这里还有一步, 生成db密码文件

db_load –T –t hash –f /etc/vsftpd/vuser_passwd.txt /etc/vsftpd/vuser_passwd.db

最后新建vuser_conf文件夹

mkdir vuser_conf

里面放的是用户限制

举个例子: test用户的

local_root=/opt/var/ftp1    #test用户能进入的目录
write_enable=YES
anon_umask=022
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES

已经完成的差不多了, 最后就是开放21端口

iptables -I INPUT -p tcp --dport 21 -j ACCEPT

保存这个规则

service iptables save

重启这个防火墙

service iptables restart

最后尝试连接:账号test密码test

验证一下test指定的目录下/opt/var/ftp1是否是这几个文件

接下来是外网连接

我使用的是ftp小黄

第一次连接的时候我的情况是这样的

然后我取消PASV验证

最后是这样的, 连接成功!

尝试下载文件

编译安装vsftpd-3.0.2的更多相关文章

  1. CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14

    准备篇: CentOS 7.0系统安装配置图解教程 http://www.osyunwei.com/archives/7829.html 一.配置防火墙,开启80端口.3306端口 CentOS 7. ...

  2. CentOS7 编译安装 nginx-1.10.0

    对于NGINX 支持epoll模型 epoll模型的优点 定义: epoll是Linux内核为处理大批句柄而作改进的poll,是Linux下多路复用IO接口select/poll的增强版本,它能显著的 ...

  3. CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.13

    CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.132013-10-24 15:31:12标签:服务器 防火墙 file 配置文件 written 一.配置好I ...

  4. CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.13+博客系统WordPress3.3.2

    说明: 操作系统:CentOS 6.2 32位 系统安装教程:CentOS 6.2安装(超级详细图解教程): http://www.osyunwei.com/archives/1537.html 准备 ...

  5. CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法分享

    一.配置防火墙,开启80端口.3306端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...

  6. 在CUDA8.0下编译安装OpenCV3.1.0来实现GPU加速(Compiling OpenCV3.1.0 with CUDA8.0 support)

    在CUDA8.0下编译安装OpenCV3.1.0 一.本人电脑配置:ubuntu 14.04, NVIDIA GTX1060. 二.编译OpenCV3.1.0前,读者需要成功安装CUDA8.0(网上有 ...

  7. Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python)

    Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python) 前提是已经安装了python2,python3 1)安装各种依赖库 sudo apt-get update ...

  8. 保姆级教程——Ubuntu16.04 Server下深度学习环境搭建:安装CUDA8.0,cuDNN6.0,Bazel0.5.4,源码编译安装TensorFlow1.4.0(GPU版)

    写在前面 本文叙述了在Ubuntu16.04 Server下安装CUDA8.0,cuDNN6.0以及源码编译安装TensorFlow1.4.0(GPU版)的亲身经历,包括遇到的问题及解决办法,也有一些 ...

  9. [笔记] Ubuntu 18.04源码编译安装OpenCV 4.0流程

    标准常规安装方法安装的OpenCV版本比较低,想尝鲜使用4.0版本,只好源码安装. 安装环境 OS:Ubuntu 18.04 64 bit 显卡:NVidia GTX 1080 CUDA:10.0 c ...

  10. 在CUDA8.0下指定位置编译安装OpenCV3.1.0来实现GPU加速(Compiling OpenCV3.1.0 with CUDA8.0 support)

    在CUDA8.0下指定位置编译安装OpenCV3.1.0 一.本人电脑配置:ubuntu 14.04, NVIDIA GTX1060. 二.编译OpenCV3.1.0前,读者需要成功安装CUDA8.0 ...

随机推荐

  1. Pycharm中如何使用科学计算库

    1.简便起见 比起麻烦的安装各种库,我们选择最方便的Anaconda的conda或pip(兼容支持)安装相关库. Pycharm本身缺少numpy和matplotlib这些库,而另一个Python的开 ...

  2. Python函数-logging.basicConfig

    在我们写程序的时候需要记录日志信息,可以用到logging.basicConfig函数 import logging logging.basicConfig(level=logging.DEBUG, ...

  3. Oracle HA 之 Server Pool 实战

    --创建server pool的两种方式:    图形界面:console和dbca       演示-略    命令行工具:srvctl和crsctl --srvctl和crsctl创建server ...

  4. InfluxDB通过HTTP API

    SELECT "value" FROM "online_user_counter" curl -POST http://localhost:8086/query ...

  5. iOS开发tableView去掉顶部上部空表区域

    tableview中的第一个cell 里上部 有空白区域,大概64像素 在viewDidLoad中加入如下代码 self.automaticallyAdjustsScrollViewInsets = ...

  6. Charles maplocal 时中文显示乱码问题

    用Charles对request进行Map Local后,app上看返回的中文是乱码? 是Map Local的文件编码有问题?是Charles设置有问题?是电脑环境有问题?哈哈,都不是 你是Andro ...

  7. requesMapping注解

    java类 package org.springframework.web.bind.annotation; import java.lang.annotation.Documented; impor ...

  8. (转)Mybatis insert后返回主键给实体对象(Mysql数据库)

    <insert id="insert" parameterType="com.zqgame.game.website.models.Team"> & ...

  9. [LeetCode] questions conclustion_Path in Tree

    Path in Tree: [LeetCode] 112. Path Sum_Easy tag: DFS       input: root, target,   return True if exi ...

  10. iOS 新浪微博-1.0框架搭建

    项目搭建 1.新建一个微博的项目,去掉屏幕旋转 2.设置屏幕方向-->只有竖向 3.使用代码构建UI,不使用storyboard 4.配置图标AppIcon和LaunchImage 将微博资料的 ...