首页 > 系统服务 > 详细

shell堡垒机

时间:2020-06-09 19:00:13      阅读:42      评论:0      收藏:0      [点我收藏+]

配置

普通用户配置

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 \t\t welcome to use bingge jumpserver"
echo -e "\e[32m \t\t ......"
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 #
############################################################################
"‘\033[37m\033[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

 

shell堡垒机

原文:https://www.cnblogs.com/gaoyanbing/p/13079682.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!