zoukankan      html  css  js  c++  java
  • Centos 6.4上面用Shell脚本一键安装vsftpd

    Centos 6.4上面用Shell脚本一键安装vsftpd

    install.sh

    #!/bin/bash
    
    if [ `uname -m` == "x86_64" ];then
    machine=x86_64
    else
    machine=i686
    fi
    ifrpm=$(cat /proc/version | grep -E "redhat|centos")
    ifdpkg=$(cat /proc/version | grep -Ei "ubuntu|debian")
    ifcentos=$(cat /proc/version | grep centos)
    
    if [ "$ifrpm" != "" ];then
        yum -y install vsftpd
        cp -f ./config-ftp/rpm_ftp/* /etc/vsftpd/
    else
        apt-get -y install vsftpd
        if cat /etc/shells | grep /sbin/nologin ;then
            echo ""
        else
            echo /sbin/nologin >> /etc/shells
        fi
        cp -fR ./config-ftp/apt_ftp/* /etc/
    fi
    
    if [ ! -f '/etc/vsftpd' ];then
         mkdir -p /etc/vsftpd
    fi
    
    if [ "$ifcentos" != "" ] && [ "$machine" == "i686" ];then
        rm -rf /etc/vsftpd/vsftpd.conf
        cp -f ./config-ftp/vsftpdcentosi686.conf /etc/vsftpd/vsftpd.conf
    fi
    
    
    if [ ! -f '/storage/vsftpd' ];then
         mkdir -p /storage/vsftpd
    fi
    
    result="`grep '^vsftpd' /etc/passwd | wc -l`"
     
    
    if [ "$result" == "0" ];then
         
        groupadd vsftpd
         
        useradd -g vsftpd -s /sbin/nologin vsftpd
    fi
    
    /etc/init.d/vsftpd start
    
    chown -R vsftpd:vsftpd /storage/vsftpd
    
    #bug kill: '500 OOPS: vsftpd: refusing to run with writable root inside chroot()'
    chmod a-w /storage/vsftpd
    
    MATRIX="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    LENGTH="9"
    while [ "${n:=1}" -le "$LENGTH" ]
    do
        PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}"
        let n+=1
    done
    if [ "$ifrpm" != "" ];then
    echo $PASS | passwd --stdin vsftpd
    else
    echo "vsftpd:$PASS" | chpasswd
    fi
    
    sed -i s/'ftp_password'/${PASS}/g account.log

    完整脚本下载:http://pan.baidu.com/s/1o6E15oA

  • 相关阅读:
    过滤'and','or' ''' '*' '=' ‘select’下的注入
    HBase 官方文档0.90.4
    MapReduce原理及操作
    HDFS原理及操作
    Sqoop介绍、安装与操作
    HBase介绍、安装与应用案例
    Mahout介绍、安装与应用案例
    Hive介绍和安装部署
    MapReduce应用案例
    Flume介绍与安装
  • 原文地址:https://www.cnblogs.com/mjorcen/p/3788346.html
Copyright © 2011-2022 走看看