• 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

  • 相关阅读:
    Webform Session、Cookies传值,跳转页面方式
    webform 光棒效果,删除操作弹出确定取消窗口
    webform Repeater、地址栏传值、Response
    WebForm 控件
    WebForm 页面传值
    WebForm——IIS服务器、开发方式和简单基础
    身份证件号的验证与更改
    历届试题 带分数
    算法提高 学霸的迷宫
    算法提高 最大乘积
  • 原文地址:https://www.cnblogs.com/mjorcen/p/3788346.html
Copyright © 2020-2023  润新知