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 ...
随机推荐
- Django框架——基础教程(总)
1. Django简介 Python下有许多款不同的 Web 框架.Django是重量级选手中最有代表性的一位.许多成功的网站和APP都基于Django. Django是一个开放源代码的Web应用框架 ...
- hadoop的价值在哪里
新霸哥注意到了在移动互联网时代,很多的传统的系统架构已经不能满足现有的业务需要了,在大数据时代,我们需要新的架构才能满足海量数据处理能力. 在实际的应用中数据增长非常的迅速,数据类型也变的丰富了,业务 ...
- c++的并发操作(多线程)
C++11标准在标准库中为多线程提供了组件,这意味着使用C++编写与平台无关的多线程程序成为可能,而C++程序的可移植性也得到了有力的保证.另外,并发编程可提高应用的性能,这对对性能锱铢必较的C++程 ...
- CUDA warning C4819的消除
问题描述:在使用VS2010编译CUDA程序时,有很多C4819警告: warning C4819:The file contains a character that cannot be repre ...
- npm安装node-sass报msbuild相关错误的解决办法
转自:https://blog.csdn.net/Amio_/article/details/87931733 https://www.cnblogs.com/diffx/p/10510868.htm ...
- oracle 环境变量问题
ORACLE_HOME 配置为oracle ..\dbhome_1 配置错误可能导致监听起不来 (也有可能是在装client时可能会更改了之前变量的值) TNS_ADMIN ...
- 浅析Java web程序之客户端和服务器端交互原理
原文链接: https://www.iteye.com/topic/470019 1. 协议 a. TCP/IP整体构架概述 TCP/IP协议并不完全符合OSI的七层参考模型.传统的开放式系统互连参考 ...
- mysql5.7.26 基于GTID的主从复制环境搭建
简单工作原理: (1)从库执行 change master to 语句,会立即将主库信息记录到master.info中 (2)从库执行 start slave语句,会立即生成IO_T和SQL_T (3 ...
- 数组与pandas模块
'''数组与pandas模块''' # numpy模块:用来做数据分析,对numpy数组(既有行又有列)--矩阵进行科学运算 # tensorflow/pytorch(数学专业/物理专业/计科专业硕士 ...
- 三大方面,分析 to B和 to C产品的区别
作为互联网从业者,我们经常听到to B(或2B)和to C(或2C)两个概念.to B即面向企业客户,to C即面向普通用户.只要是互联网人基本都懂知道这两个概念,但如果别人再问“to B和to C产 ...