• shell堡垒机


    配置

    普通用户配置

    useradd ops

    su - ops

    vim .bashrc 

    /usr/bin/conn

    root用户配置

    .bashrc 

    /sbin/super

    连接脚本:

    [root@h020 ~]# cat /usr/bin/conn
    #!/bin/bash
    echo "Please enter the root password to get administrator privileges"
    for i in {two,one,0}
    do
    su - root && i=hehe
    if [ $i == hehe ];then
    exit
    fi
    if [ $i != 0 ];then
    echo "please input root passwd,now You heve $i chance"
    fi
    done
    exit

    跳板机脚本:

    [root@h020 ~]# cat /sbin/super
    #!/bin/bash

    echo -e "e[31m welcome to use bingge jumpserver"
    echo -e "e[32m ......"
    echo -e "##############Pleaes choose you want to connect server######################:
    # 1:192.168.15.164(gitlab) #
    # 2:192.168.15.165(jenkins) #
    # 3:192.168.15.169(ansible) #
    # q:use local server #
    ############################################################################
    "'33[37m33[0m'


    echo -e "Please input num:"
    while [ True ];
    do
    read -p "" num
    case "$num" in
    1) ssh 192.168.15.164 && echo "pleaes choose you want to connect server" ;;
    2) ssh 192.168.15.165 && echo "pleaes choose you want to connect server" ;;
    3) ssh 192.168.15.169 && echo "pleaes choose you want to connect server" ;;
    q) exit ;;
    *) echo "input error please input again" ;;

    esac

    done

  • 相关阅读:
    数组和矩阵问题
    Memcached安装以及PHP的调用
    php函数ob_start()、ob_end_clean()、ob_get_contents()
    Nginx
    电影大全 API接口
    找电影资源最强攻略,知道这些你就牛B了!
    CSS3 图片旋转
    curl网站开发指南
    Redis 集群方案
    从12大技巧、30个案例、99个模板谈怎么写标题
  • 原文地址:https://www.cnblogs.com/gaoyanbing/p/13079682.html
Copyright © 2020-2023  润新知