1、分发密钥(使用普通用户)

ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
ssh-copy-id -i  .ssh/id_dsa.pub 172.16.1.7
ssh-copy-id -i  .ssh/id_dsa.pub 172.16.1.8

2、编写脚本

[root@m01 profile.d]# cat /server/scripts/tiaoban.sh 
#!bin/sh
function trapper(){
  trap '' INT QUIT TSTP TERM HUB
}
function menu(){
        cat <<-EOF
==============Host List==============
        1-172.16.1.7/24
        2-172.16.1.8/24
        0-Exit system
=====================================
        EOF
}
function host(){
    case "$1" in
      1)
        ssh $USER@172.16.1.7
      ;;
      2)
        ssh $USER@172.16.1.8
      ;;
      0)
        exit 0
      esac
}
function main(){
   while true
     do
        trapper
        clear
        menu
        read -p "Pls input your choice:" num
        host $num
     done
}
main
[root@m01 profile.d]# cat /etc/profile.d/tiaoban.sh 
[ $UID -ne 0 ] && \
. /server/scripts/tiaoban.sh

3、用普通用户登录跳板机测试,效果图如下:

wKioL1ZY6DSw71CLAAAvEpdz5ZA100.png