文章目录
问题描述
经常遇到安装 vsftp,或给新人开 ftp权限的需求,这里记录下
vsftpd安装脚本
脚本在 rocky linux 9.3运行一点问题没有,如果在 centos6,centos7运行,请将yum -y install libdb-utils替换成yum -y install db4-utils
#!/bin/bash
# 安装 vsftpd 和 libdb-utils
set -x
GFIPREFIX=/usr/local/data
GFIUSER=www
yum -y install vsftpd
yum -y install libdb-utils
# 创建 vsftpd 运行目录
[ ! -d /var/run/www ] && mkdir /var/run/www
# 切换到 vsftpd 配置目录
cd /etc/vsftpd
# 创建用户认证数据库
cat > loguser.txt <<EOF
zhangsan
123456
EOF
db_load -T -t hash -f /etc/vsftpd/loguser.txt /etc/vsftpd/loguser.db
# 配置 PAM 认证
[ -f /etc/pam.d/vsftpd ] &&