• Linux系统 SSH免密登入


    mia

    # ssh-keygen -t rsa

    # cp -r /root/.ssh/d_rsa.pub  /root/.ssh/authorized_keys

    # ssh-copy-id 192.168.2.176

     #!/bin/bash

    Server_IP=

    Server_Passwd=

    function SSH_CopyID(){

    expect -c "

            set timeout -1

            spawn ssh-keygen -t rsa

            expect {

                    "(/root/.ssh/id_rsa):" { send " " ;}

                    "(empty for no passphrase):" { send " ";}

                    "again:" { send " " ;}

            };

            expect eof;

        "

    expect -c "

            set timeout -1;

            spawn ssh-copy-id $Server_IP;

            expect {

                    "yes/no" { send "yes " ;}

                    "password:" { send "$Server_Passwd ";}

            };

            expect eof;

       "

    }

    SSH_CopyID

  • 相关阅读:
    小学四则算式扩充
    软件工程初涉之感
    回头
    个人最终总结
    团队作业
    结对编程
    老李的blog使用日记(3)
    进度
    老李的blog使用日记(2)
    红果果
  • 原文地址:https://www.cnblogs.com/devops-docker/p/11507172.html
Copyright © 2020-2023  润新知