linux下WEB服务器安装、配置VSFTP
转载 http://www.oicto.com/centos-vsftp/?tdsourcetag=s_pcqq_aiomsg
linux下WEB服务器安装、配置VSFTP
服务器环境:CentOS 6.5 64位
#检查系统是否已安装vsftp
命令:rpm -q vsftpd
package vsftpd is not installed #说明系统没有安装vsftpd
一、vsftp安装
# 安装vsftpd
yum -y install vsftpd
# 启动
service vsftpd start
# 开机启动
chkconfig vsftpd on
二、vsftp相关命令
# 启动ftp服务
service vsftpd start
# 查看ftp服务状态
service vsftpd status
# 重启ftp服务
service vsftpd restart
# 关闭ftp服务
service vsftpd stop
三、目录文件说明:
/etc/vsftpd/vsftpd.conf vsftpd的核心配置文件
/etc/vsftpd/ftpusers 用于指定哪些用户不能访问FTP服务器
/etc/vsftpd/user_list 指定允许使用vsftpd的用户列表文件
/etc/vsftpd/vsftpd_conf_migrate.sh 是vsftpd操作的一些变量和设置脚本
/var/ftp/ 默认情况下匿名用户的根目录
====基于虚拟账户权限认证====
vsftpd的虚拟用户采用单独的用户名/口令保存方式,与系统账户分离,这大大增强了系统的安全性。vsftpd可以采用数据库文件来保存用户/口令,如hash;也可以将用户/口令保存在数据库服务器中,如MySQL等。vsftpd验证虚拟用户,则采用PAM方式
安装依赖包
yum install -y db4 db4-utils
创建虚拟用户账号和密码
(奇数行为用户名,偶数行为用户密码)
vi /etc/vsftpd/virtual.users
user1 #虚拟用启名
123 #用户口令
user2
456
生成虚拟用户认证的db文件
db_load -T -t hash -f /etc/vsftpd/virtual.users /etc/vsftpd/vsftpd.login.db
chmod 600 /etc/vsftpd/vsftpd.login.db
配置PAM信息
在/etc/pam.d/创建一个文件,命名为vsftpd.pam(可自定义)
vi /etc/pam.d/vsftpd.pam
auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd.login
account required /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd.login
配置vsftpd.conf
配置前先备份
cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak
配置如下:
anonymous_enable=NO
local_enable=YES
local_umask=022
anon_umask=022
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
ascii_upload_enable=YES
ascii_download_enable=YES
ftpd_banner=Welcome to blah FTP service.
chroot_local_user=YES
listen=YES
userlist_enable=YES
pam_service_name=vsftpd.pam
guest_username=ftp #虚拟用户所映射的本地用户。这里也改成与web服务器用户一致的用户名www,这样就可以保持ftp与web具有同等权限。
guest_enable=YES #这个是开启虚拟用户
user_config_dir=/etc/vsftpd/vsftpd_user_conf
tcp_wrappers=YES
创建用户名的配置文件
mkdir -p /etc/vsftpd/vsftpd_user_conf
cd /etc/vsftpd/vsftpd_user_conf
在conf里创建 刚才用户名的配置文件 配置文件名要与用户名一样
user1要有所有全部权限
vi user1
user2只有上传和下载权限
vi user2
# 重启ftp服务
service vsftpd restart
====常见的vsftpd日志解决方案====
配置vsftpd.conf,
# 表明FTP服务器记录上传下载的情况
xferlog_enable=YES
# 表明将记录的上传下载情况写在xferlog_file所指定的文件中,即xferlog_file选项指定的文件中
xferlog_std_format=YES
xferlog_file=/var/log/xferlog
# 启用双份日志。在用xferlog文件记录服务器上传下载情况的同时, vsftpd_log_file所指定的文件,即/var/log/vsftpd.log也将记录登录、上传、下载、删除的情况
dual_log_enable=YES
vsftpd_log_file=/var/log/vsftpd.log
====日常管理虚拟用户账号和密码====
修改文件
vi /etc/vsftpd/virtual.users
生成虚拟用户认证的db文件
db_load -T -t hash -f /etc/vsftpd/virtual.users /etc/vsftpd/vsftpd.login.db
# 重启ftp服务
service vsftpd restart
jpg 改 rar
相关文章
- Linux 典型应用之WebServer 安装和配置
- Oracle-Linux安装配置python3.6环境
- 优化GNU/Linux桌面安装的九个步骤
- Linux 有问必答:如何在CentOS或者RHEL上安装REMI仓库
- 在 Debian Linux 上安装配置 ISC DHCP 服务器
- Docker第二讲 在Linux系统安装配置docker
- redis-windows和linux下安装
- Linux Deepin安装nodejs、npm、yarn、nrm
- linux安装MongoDB
- 《循序渐进Linux(第2版) 基础知识 服务器搭建 系统管理 性能调优 虚拟化与集群应用》——第2章 Linux系统的安装与基础配置 2.1安装需求
- Linux进行yum 程序安装时遇到的公钥没有安装的问题解决方法
- Linux下安装php环境并且配置Nginx支持php-fpm模块
- 《高性能Linux服务器构建实战:系统安全、故障排查、自动化运维与集群架构》——3.2 DRDB的安装与配置
- Linux安装配置vsftp搭建FTP的详细配置
- linux 之JDK安装
- Redis—怎么查看Linux有没有安装Redis,如何启动Redis
- linux系统安装redis服务器与php redis扩展
- Linux中Nginx安装与配置详解 test(待整理 补全)
- 11款最棒的Linux数据恢复工具
- linux 安装开启SNMP协议,最下面是yum安装
- Linux下SVN安装配置
- Linux安装配置ELK日志收集系统,elasticsearch+kibana+filebeat轻量级配置安装
- Linux - Ubuntu里安装指定版本的package
- Linux CentOS 系统安装 和 相关配置
- linux 系统 cp: omitting directory 问题解决