centos安装FTP脚本
一键安装脚本 只需要自己设置一下脚本开头的几个字符串参数即可
#!/bin/bash
port=""
user="code"
pass=""
dir="/root/web"
ip="123.125.114.144"
yum -y install vsftpd*
yum -y install pam*
yum -y install db4* echo "install ok"
rm -rf /etc/vsftpd
mkdir /etc/vsftpd
rm -f /etc/vsftpd/vsftpd.conf
cat >/etc/vsftpd/vsftpd.conf<<EOF
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=
ascii_upload_enable=YES
ascii_download_enable=YES
listen=YES
listen_port=$port
pam_service_name=vsftpd
chroot_list_enable=YES
pasv_promiscuous=YES
pasv_enable=YES
pasv_min_port=
pasv_max_port=
pasv_address=$ip
use_localtime=YES
dual_log_enable=YES pam_service_name=vsftpd
guest_enable=YES
guest_username=ftp
user_config_dir=/etc/vsftpd/vuser_conf
EOF rm -f /etc/vsftpd/chroot_list
touch /etc/vsftpd/chroot_list
rm -f /etc/vsftpd/vuser_passwd.txt
cat >/etc/vsftpd/vuser_passwd.txt<<EOF
$user
$pass
EOF rm -f /etc/vsftpd/vuser_passwd.db
db_load -T -t hash -f /etc/vsftpd/vuser_passwd.txt /etc/vsftpd/vuser_passwd.db rm -f /etc/pam.d/vsftpd
cat >/etc/pam.d/vsftpd<<EOF
auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd
account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd
EOF rm -rf /etc/vsftpd/vuser_conf/
mkdir /etc/vsftpd/vuser_conf/ rm -f /etc/vsftpd/vuser_conf/code
cat >/etc/vsftpd/vuser_conf/code<<EOF
local_root=$dir
allow_writeable_chroot=YES
chroot_local_user=YES
write_enable=YES
anon_umask=
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
EOF mkdir -p $dir
chmod -R $dir
chown -R $user:$user $dir
setenforce
service vsftpd stop
service vsftpd start
systemctl stop vsftpd
systemctl start vsftpd
/sbin/iptables -D INPUT -p tcp --dport $port -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport $port -j ACCEPT
/sbin/iptables -D INPUT -p tcp --dport : -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport : -j ACCEPT
netstat -tunlp|grep $port
如果出现如下错误
OOPS: unrecognised variable in config file: allow_writeable_chroot
说明你安装的vsftpd版本稍微有点旧 不支持变量allow_writeable_chroot 编辑/etc/vsftpd/vuser_conf/code文件 在allow_writeable_chroot前面加一个#就可以注释了
然后重启一下vsfpds
service vsftpd restart
centos安装FTP脚本的更多相关文章
- centos 安装FTP server详情(转)
centos 安装FTP server详情 分类: linux 2013-12-27 16:45 227人阅读 评论(0) 收藏 举报 我们这里以安装vsftpd 服务器端为例子: 1.进入到cent ...
- CentOS 安装ftp
Linux安装ftp组件 1 安装vsftpd组件 安装完后,有/etc/vsftpd/vsftpd.conf 文件,是vsftp的配置文件. [root@bogon ~]# yum -y insta ...
- 基于CentOS安装FTP服务器
操作系统环境: CentOS Linux release 7.4.1708 (Core) 使用yum安装ftp服务: yum install -y vsftpd 添加系统用户作为登录ftp服务器并修改 ...
- Centos 安装 FTP
安装教程: 基于 CentOS 搭建 FTP 文件服务 搭建完成后,使用windows文件夹访问FTP报错,请确保输入的文件名是否正确,并且您有权访问此文件. 先确认ftp服务正常 修改: 设 ...
- centos 安装ftp服务器
CentOS下搭建FTP服务器简单记录. 1.安装vsftpd yum install vsftpd 2.编辑iptablesvi /etc/sysconfig/iptables -A INPUT - ...
- CentOS安装FTP服务
最近公司有一个内部比赛(黑客马拉松),报名参加了这么一个赛事,在准备参赛作品的同时(参赛服务器需要自己搭建),借着这个机会,决定把tomcat部署相关的知识从0到1重新捋一遍.就当备忘录了. FTP服 ...
- 阿里云centos安装ftp与svn过程
1.下载xshell或者secureCRT 2.登录centos或者服务器 3.安装vsftpd [root@xxx]# yum install vsftpd //安装vsftpd [root@xxx ...
- Linux centos 安装 ftp(Vsftp) 与 设置ftp(Vsftp)
本文章只是简单搭建,因为公司只须要简单使用,虽然简单但是之前也走了一些弯路,所以决定把过程记录下来. 一.Vsftp安装与卸载 安装:yum install vsftpd 卸载:yum remove ...
- centos安装ftp
yum install -y vsftpd安装vsftpd service vsftpd start 启动vsftpd vim /etc/vsftpd/vsftpd.conf 将anonymous_e ...
随机推荐
- luogu P4482 [BJWC2018]Border 的四种求法
luogu 对于每个询问从大到小枚举长度,哈希判断是否合法,AC 假的(指数据) 考虑发掘border的限制条件,如果一个border的前缀部分的末尾位置位置\(x(l\le x < r)\)满 ...
- electron localStorage的bug
在更新 electron 后有可能会读不到 localStorage 里的数据 推测是 localStorage 写在 Chromium 内核里,更新 electron 同时会更新 Chromium, ...
- openCV3测试指南
本文来源于https://docs.opencv.org/3.4.1/db/df5/tutorial_linux_gcc_cmake.html 经测试整理后发布 上一节安装完成了openCV,这一节进 ...
- 转载: utm坐标和经纬度相互转换
原文地址: https://blog.csdn.net/hanshuobest/article/details/77752279 //经纬度转utm坐标 int convert_lonlat_utm( ...
- Linux中断流程分析
裸机中断: 1.中断流入口 2.事先注册中断处理程序 3.根据中断源编号,调取处理程序 irq_svc:1.等到产生中断源的编号(每一个中断号都有一个描述结构) 2.
- mysql向表中某字段前后追加一段字符串 concat(), trim(), ltrim(), rtrim(), repeat()
1.mysql向表中某字段后面追加一段字符串:update table_name set field=CONCAT(field, '分隔符', str);//'分隔符',可以为空,也可以省略updat ...
- STL源码阅读-functor与adapter
为什么要用仿函数 函数指针不灵活,难以与STL其他组件配合使用 Adapter 将一个class的接口转换为另一个class的接口,使原本因接口不兼容而不能合作的classes,可以一起运作 STL中 ...
- Gym - 102040F Path Intersection (树链剖分+线段树)
题意:给出棵树上的k条路径,求这些路径的公共点数量. 将每条路径上的点都打上标记,被标记过k次的点就是公共点了.由于公共点形成的区间是连续的,因此直接在线段树上暴搜即可在$O(logn)$求出一条链上 ...
- 严重: Servlet [SelectController] in web application [/servlet4] threw load() exception
在web.xml路径配置.jar包导入都正确的情况下,那就考虑是环境问题. 1.servers-->clean 将代码从tomcat中清除 2.Project-->clean 将ecli ...
- java多线程之生产者消费者模型
public class ThreadCommunication{ public static void main(String[] args) { Queue q = new Queue();//创 ...