热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Debian系统下搭建vsftpd示例

为什么80%的码农都做不了架构师?系统环境#uname-aLinuxvsftp.jessie.cn3.16.0-4-amd64#1SMPDebian3.16.

为什么80%的码农都做不了架构师?>>>   hot3.png

系统环境

# uname -a
Linux vsftp.jessie.cn 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64 GNU/Linux
# vsftpd -v
vsftpd: version 3.0.2

配置文件

Env init

apt-get -y install vsftpd db5.3-util
mkdir -pv /etc/vsftpd/roles /data/log/vsftpd /mnt/ftp/higkoo
touch /etc/vsftpd/{chroot-list,user-list,issue,accounts,create.sh} /etc/pam.d/vsftpd.ftp
openssl req -newkey rsa:2048 -x509 -nodes -days 3650 -out /etc/vsftpd/vsftp-cert.pem -keyout /etc/vsftpd/vsftp-cert.pem
chown -R ftp:ftp /mnt/ftp /data/log/vsftpd
openssl req -newkey rsa:2048 -x509 -nodes -days 3650 -out /etc/vsftpd/vsftp-cert.pem -keyout /etc/vsftpd/vsftp-cert.pem

/etc/vsftpd.conf

anon_mkdir_write_enable=NO
anon_root=/dev/zero
anon_upload_enable=NO
anon_world_readable_only=YES
anonymous_enable=NO
banner_file=/etc/vsftpd/issue
chroot_local_user=YES
chroot_list_enable=YES # 安全限制
chroot_list_file=/etc/vsftpd/chroot-list
allow_writeable_chroot=YES
userlist_deny=YES # 用户黑名单功能
userlist_file=/etc/vsftpd/user-list
data_connection_timeout=120
dirmessage_enable=NO
ftpd_banner=Welcome to ops ftp.
guest_enable=YES
guest_username=ftp
hide_file={\.*}
idle_session_timeout=600
listen_ipv6=NO
connect_from_port_20=NO
ftp_data_port=50234
listen_port=21
listen=YES
local_enable=YES
local_umask=022
log_ftp_protocol=YES
syslog_enable=NO
pam_service_name=vsftpd.ftp
passwd_chroot_enable=NO
pasv_enable=YES
pasv_min_port=62222
pasv_max_port=62333
tcp_wrappers=YES
use_localtime=NO
user_config_dir=/etc/vsftpd/roles
userlist_enable=YES
virtual_use_local_privs=YES
write_enable=YES
xferlog_enable=YES
xferlog_enable=YES
xferlog_std_format=YES
xferlog_file=/data/log/vsftpd/xfer.log
vsftpd_log_file=/data/log/vsftpd/vsftpd.log
ssl_enable=YES
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=YES
ssl_sslv3=YES
rsa_cert_file=/etc/vsftpd/vsftp-cert.pem
max_per_ip=30
max_clients=200
ssl_ciphers=HIGH
require_ssl_reuse=NO
log_ftp_protocol=yes
dual_log_enable=YES
lock_upload_files=NO

/etc/vsftpd/roles/higkoo

local_root=/mnt/ftp/higkoo
anon_world_readable_only=NO
write_enable=YES
anon_upload_enable=NO

/etc/vsftpd/create.sh

/bin/mv -fv /etc/vsftpd/accounts.db /tmp
/usr/bin/db_load -T -t hash -f /etc/vsftpd/accounts /etc/vsftpd/accounts.db
/bin/chmod 0600 /etc/vsftpd/accounts.db /etc/vsftpd/accounts

/etc/pam.d/vsftpd.ftp

auth sufficient /lib/x86_64-linux-gnu/security/pam_userdb.so db=/etc/vsftpd/accounts
account sufficient /lib/x86_64-linux-gnu/security/pam_userdb.so db=/etc/vsftpd/accounts

/etc/vsftpd/accounts

higkoo
MyPassWords

IP限制

&#61;&#61;> /etc/hosts.allow <&#61;&#61;
vsftpd:123.223.233.8:allow
vsftpd:192.186.233.:allow&#61;&#61;> /etc/hosts.deny <&#61;&#61;
vsftpd:all:deny

登录日志

ftp客户端

&#61;&#61;> /data/log/vsftpd/vsftpd.log <&#61;&#61;
CONNECT: Client "180.157.70.197"
FTP response: Client "123.223.233.8", "220 - biliops"
FTP response: Client "123.223.233.8", "220 "
FTP command: Client "123.223.233.8", "AUTH TLS"
FTP response: Client "123.223.233.8", "234 Proceed with negotiation."
FTP command: Client "123.223.233.8", "USER higkoo"
[ops] FTP response: Client "123.223.233.8", "331 Please specify the password."
[ops] FTP command: Client "123.223.233.8", "PASS "
[ops] OK LOGIN: Client "123.223.233.8"
[ops] FTP response: Client "123.223.233.8", "230 Login successful."
[ops] FTP command: Client "123.223.233.8", "SYST"
[ops] FTP response: Client "123.223.233.8", "215 UNIX Type: L8"
[ops] FTP command: Client "123.223.233.8", "FEAT"
[ops] FTP response: Client "123.223.233.8", "211-Features:"
[ops] FTP response: Client "123.223.233.8", " AUTH SSL"
[ops] FTP response: Client "123.223.233.8", " AUTH TLS"
[ops] FTP response: Client "123.223.233.8", " EPRT"
[ops] FTP response: Client "123.223.233.8", " EPSV"
[ops] FTP response: Client "123.223.233.8", " MDTM"
[ops] FTP response: Client "123.223.233.8", " PASV"
[ops] FTP response: Client "123.223.233.8", " PBSZ"
[ops] FTP response: Client "123.223.233.8", " PROT"
[ops] FTP response: Client "123.223.233.8", " REST STREAM"
[ops] FTP response: Client "123.223.233.8", " SIZE"
[ops] FTP response: Client "123.223.233.8", " TVFS"
[ops] FTP response: Client "123.223.233.8", "211 End"
[ops] FTP command: Client "123.223.233.8", "PBSZ 0"
[ops] FTP response: Client "123.223.233.8", "200 PBSZ set to 0."
[ops] FTP command: Client "123.223.233.8", "PROT P"
[ops] FTP response: Client "123.223.233.8", "200 PROT now Private."
[ops] FTP command: Client "123.223.233.8", "PWD"
[ops] FTP response: Client "123.223.233.8", "257 "/""
[ops] FTP command: Client "123.223.233.8", "TYPE I"
[ops] FTP response: Client "123.223.233.8", "200 Switching to Binary mode."
[ops] FTP command: Client "123.223.233.8", "PASV"
[ops] FTP response: Client "123.223.233.8", "227 Entering Passive Mode (88,123,66,22,223,233)."
[ops] FTP command: Client "123.223.233.8", "LIST"
[ops] FTP response: Client "123.223.233.8", "150 Here comes the directory listing."
[ops] FTP response: Client "123.223.233.8", "226 Directory send OK."
[ops] FTP command: Client "123.223.233.8", "MDTM tengine_2.1.1-2_amd64.deb"
[ops] FTP response: Client "123.223.233.8", "213 20151229123456"

中文显示

文件名支持中文

  1. 修改环境变量 /etc/profile.d/chinese.sh

LC_ALL&#61;"zh_CN.UTF-8"
LANG&#61;"zh_CN.UTF-8"
LANGUAGE&#61;"zh_CN.UTF-8:zh:en_US:en"
export LC_ALL LANG LANGUAGE

  1. 安装依赖

sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales
. /etc/profile
locale

ftp日志支持中文

  1. 据说vsftpd的日志要支持中文&#xff0c;必须改源码或使用syslog。机智的我选择后者、修改 /etc/vsftpd.conf &#xff1a;

syslog_enable&#61;YES

  1. 在syslog添加vsftpd的配置 /etc/rsyslog.d/vsftpd.conf&#xff1a;

ftp.* /data/log/vsftpd/sys.log

  1. 如果不希望ftp日志在/var/log/messages显示&#xff0c;需要追加 ftp.none/etc/rsyslog.conf&#xff1a;

*.&#61;info;*.&#61;notice;*.&#61;warn;\auth,authpriv.none;\cron,daemon.none;\mail,news.none,ftp.none -/var/log/messages

  1. 重启服务&#xff0c;验证成功&#xff1a;
    支持中文

转:https://my.oschina.net/anglix/blog/591495



推荐阅读
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • 图像因存在错误而无法显示 ... [详细]
  • 用ESP32与Python实现物联网(IoT)火焰检测报警系统
    下图是本案例除硬件连线外的3步导学开发过程,每个步骤中实现的功能请参考图中的说明。在硬件连线完成之后我们建议您先使用“一分钟上云体验”功能预先体验本案例的实际运行效果 ... [详细]
  • Nginxgaodaima.comnginx属于七层架构,支持的是http协议,本身对tcp协议没有支持。所以不能代理mysql等实现负载均衡。但是lvs这个东西不熟悉,主要是公司 ... [详细]
  • 文件上传漏洞利用介绍
    目录文件上传漏洞利用介绍1.绕过js验证2.绕过MIME-TYPE验证3.绕过基于黑名单验证基于文件后缀名验证介绍基于文件后缀名验证方式的分类基于黑名单验证代码分析利 ... [详细]
  • Jenkins的分布式构建,在Jenkins的配置中叫做节点,分布式构建能够让同一套代码或项目在不同的环境(如:Windows和Linux系统)中编译、部署等。将jenkins项目 ... [详细]
  • FTP服务ftp的报错及用户管理
    ftp服务常见报错530报错认证失败(密码错误或者服务端拒绝)550服务本身未开启553文件系统不可写(权限问题)500服 ... [详细]
  • Linux服务器密码过期策略、登录次数限制、私钥登录等配置方法
    本文介绍了在Linux服务器上进行密码过期策略、登录次数限制、私钥登录等配置的方法。通过修改配置文件中的参数,可以设置密码的有效期、最小间隔时间、最小长度,并在密码过期前进行提示。同时还介绍了如何进行公钥登录和修改默认账户用户名的操作。详细步骤和注意事项可参考本文内容。 ... [详细]
  • Linux重启网络命令实例及关机和重启示例教程
    本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。 ... [详细]
  • 图解redis的持久化存储机制RDB和AOF的原理和优缺点
    本文通过图解的方式介绍了redis的持久化存储机制RDB和AOF的原理和优缺点。RDB是将redis内存中的数据保存为快照文件,恢复速度较快但不支持拉链式快照。AOF是将操作日志保存到磁盘,实时存储数据但恢复速度较慢。文章详细分析了两种机制的优缺点,帮助读者更好地理解redis的持久化存储策略。 ... [详细]
  • sklearn数据集库中的常用数据集类型介绍
    本文介绍了sklearn数据集库中常用的数据集类型,包括玩具数据集和样本生成器。其中详细介绍了波士顿房价数据集,包含了波士顿506处房屋的13种不同特征以及房屋价格,适用于回归任务。 ... [详细]
  • Linux环境变量函数getenv、putenv、setenv和unsetenv详解
    本文详细解释了Linux中的环境变量函数getenv、putenv、setenv和unsetenv的用法和功能。通过使用这些函数,可以获取、设置和删除环境变量的值。同时给出了相应的函数原型、参数说明和返回值。通过示例代码演示了如何使用getenv函数获取环境变量的值,并打印出来。 ... [详细]
  • 本文介绍了Android 7的学习笔记总结,包括最新的移动架构视频、大厂安卓面试真题和项目实战源码讲义。同时还分享了开源的完整内容,并提醒读者在使用FileProvider适配时要注意不同模块的AndroidManfiest.xml中配置的xml文件名必须不同,否则会出现问题。 ... [详细]
  • 如何在php文件中添加图片?
    本文详细解答了如何在php文件中添加图片的问题,包括插入图片的代码、使用PHPword在载入模板中插入图片的方法,以及使用gd库生成不同类型的图像文件的示例。同时还介绍了如何生成一个正方形文件的步骤。希望对大家有所帮助。 ... [详细]
  • 一、概述nmon是一种在AIX与各种Linux操作系统上广泛使用的监控与分析工具,相对于其它一些系统资源监控工具来说,nmon所记录的信息是比较全面的 ... [详细]
author-avatar
粪青12_601
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有