linux 免用户密码登录

    由于线上是先登录堡垒机,再通过堡垒机ssh各服务主机,每次输入用户名密码很麻烦,免登脚本如下

1.生成ssh  key(不会的请移步百度)

2.

#author cc
sshrsakey="echo ssh-rsa AxxxQ== [email protected] >> ~/.ssh/authorized_keys"
case "$1" in
    
    zookeeper)
        echo "add zookeeper servers' authorized_keys..."
        pgm -A -f ~/kafkaservers $sshrsakey
				;;
     mongo)
        echo "add mongo servers' authorized_keys..."
        pgm -A -f ~/mongodbserver $sshrsakey
                                ;;
redis)
        echo "add mongo servers' authorized_keys..."
        pgm -A -f ~/redisservers $sshrsakey
                                ;;      
*)
        echo "Usage :$0 {zookeeper|mongo|redis}"
        exit 1
esac
exit 0

你可能感兴趣的:(linux 免用户密码登录)