利用shell初步搭建jumpserver

#!/usr/bin/bash
#jumpserver
trap "" HUP INT OUIT TSTP
clear
while :
do
webserver=192.168.117.101
mysql=192.168.117.102
cat <<-EOF
1.WEB
2.MYSQL
EOF

read -p "input number: " num

case "$num" in
1) ssh lx@$webserver
;;
2) ssh lx@$mysql
;;
*) echo "error"
;;
esac
done

修改lx .bash_profile或者bashrc等,让sh文件开机执行

ssh生成密钥
[lixin@lx ~]$ ssh-keygen
[lixin@lx ~]$ ssh-copy-id 192.168.117.101

猜你喜欢

转载自blog.51cto.com/13620507/2126139