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 ...
随机推荐
- 键盘事件 Ctrl+p 模拟(vue)
方法定义 // 打印页面 printpage(myDiv) { // myDiv 为打印对象的id名 var newstr = document.getElementById(myDiv).inner ...
- SVM处理多分类问题
"one-against-one" approach from sklearn import svm X = [[0], [1], [2], [3]] Y = [0, 1, 2, ...
- 【Groovy】 Groovy笔记
一.简单了解Groovy Groovy简介: Groovy是基于JVM的敏捷开发语言,语法与Java类似,但更加简洁,容错性也比Java强,同时Java能非常好的契合(例如Groovy能够使用Java ...
- 批处理 使用默认浏览器 打开html文件
@echo offfor /f "tokens=3,4" %%a in ('"reg query HKEY_CLASSES_ROOT\http\shell\open\co ...
- 05-spring框架—— Spring 事务
5.1 Spring 的事务管理 事务原本是数据库中的概念,在 Dao 层.但一般情况下,需要将事务提升到业务层,即 Service 层.这样做是为了能够使用事务的特性来管理具体的业务. 在 Spri ...
- Laying out a webpage is easy with flex
Flex写起来省劲很多,只用加上flex-wrap:wrap在container上.Html5 playground
- Codeforces 708D 上下界费用流
给你一个网络流的图 图中可能会有流量不平衡和流量>容量的情况存在 每调整一单位的流量/容量 需要一个单位的花费 问最少需要多少花费使得原图调整为正确(可行)的网络流 设当前边信息为(u,v,f, ...
- 第三次java测验1
设计思想: 输入一个字符串,然后将字符串倒置,比较字符串第i位上的字符与倒数第i位上的字符是否相同,如果都相同则字符串是回文:否则字符串不是回文. 源代码: package java3; import ...
- JavaScript中数组元素删除的七大方法汇总
原文链接:https://blog.csdn.net/u010323023/article/details/52700770 在JavaScript中,除了Object之外,Array类型恐怕就是最常 ...
- Windows系统下如何卸载干净mysql
一.在控制面板中卸载mysql软件 二.卸载过后删除C:\Program Files (x86)\MySQL该目录下剩余了所有文件,把mysql文件夹也删了 三.windows+R运行“regedit ...