首先准备好服务器123
跳板机安全思路,首先只监控服务器内网网络
通过vpn拨号登录其他服务器
在跳板机上和其他服务器上设置登录的ssh key
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
不等于root 和500的用户就执行脚本
[ $UID -ne 0 ] && [ $UID -ne 500 ] &&\
./scprit/tiaoban.sh
[root@localhost scprit]# cat tiaoban.sh #!/bin/bash function trapper(){ trap '' INT QUIT TSTP TERM HUP } function menu(){ cat <<-EOF ========HOST NAME LIST ============ 1)192.168.1.125 2)192.168.1.217 3)EXIT EOF } function host(){ case "$1" in 1) ssh [email protected] ;; 2) ssh [email protected] ;; 3|*) exit esac } function main(){ while true do trapper clear menu read -p "please selet:" num host $num done } main
One comment
ssh [email protected] 注意需要客户机有这个用户!不然无法登录