• vsftpd增加和删除用户的shell脚本


    前面送上ubuntu vsftpd一键安装shell脚本,这次也管理vsftpd的脚本也一并奉献,转载标明:hcjavascript

    增加用户

    #!/bin/bash
    read -p "Account: " account
    fpath=/home/vsftpd/$account
    if [ -e $fpath ]
    then
        echo "ERROR: User is exists! "
        exit
    else
        read -p "Password: " password
        if [ $account = $password ]
        then
            echo "ERROR:Account and Password same "
            exit
        fi
        echo $account >> /home/vsftpd_login
        echo $password >> /home/vsftpd_login
            
        rm -rf /etc/vsftpd_login.db
        db5.1_load -T -t hash -f /home/vsftpd_login /etc/vsftpd_login.db
    
        mkdir $fpath $fpath/www
        chmod a-w $fpath
        chmod 777 $fpath/www
        echo "MESSAGE: success! "
        
        cp -p /etc/vsftpd_user_conf/default /etc/vsftpd_user_conf/$account
        echo 'local_root='$fpath >> /etc/vsftpd_user_conf/$account
    
        service vsftpd restart
    
    fi

    删除用户

    #!/bin/bash
    read -p "Account: " account
    fpath=/home/vsftpd/$account
    if [ -e $fpath ]
    then
        sed "/$account/{N;d}" /home/vsftpd_login > /home/temp
        cat /home/temp > /home/vsftpd_login
        rm -rf temp
    
        rm -rf /etc/vsftpd_login.db
        db5.1_load -T -t hash -f /home/vsftpd_login /etc/vsftpd_login.db
    
        rm -rf $fpath
        rm -rf /etc/vsftpd_user_conf/$account
    
        echo "MESSAGE: Del success! "
        service vsftpd restart
    else
        echo "ERROR: User not fond! "
        exit
    fi
  • 相关阅读:
    random,time,os
    内置函数
    迭代器,生成器,开放封闭原则,列表推导式
    函数的有用信息
    装饰器
    动态参数,作用域,闭包
    初始函数def
    python之文件操作
    “SLR”指人造卫星激光测距,“VLBI”指甚长基线干涉测量。
    解压软件使用方法
  • 原文地址:https://www.cnblogs.com/hcjs/p/5374133.html
Copyright © 2020-2023  润新知