• 服务器免密登陆脚本


    yum install -y tcl tclx tcl-devel

    wget http://sourceforge.net/projects/expect/files/Expect/5.45/expect5.45.tar.gz/download

    tar xzvf download

    cd expect5.45

    ./configure

    make && make install

    ln -sf /data/expect5.45/libexpect5.45.so  /usr/lib64/libexpect5.45.so

    expect

     

    vim autossh.sh

     

    #!/usr/bin/expect

    set timeout 10 

    set username [lindex $argv 0]

    set password [lindex $argv 1]

    set hostname [lindex $argv 2]

    spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $username@$hostname

    expect {

        "*assword" {send "$password ";}

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

    }

    expect eof

     

    chmod +x autossh.sh

     

    ./autossh.sh root password ip

  • 相关阅读:
    设计模式-状态模式
    Nginx相关
    Docker基础使用
    JavaScript定时器及回调用法
    前端交互篇
    基于ConcurrentHashMap的本地缓存
    J.U.C体系进阶(五):juc-collections 集合框架
    J.U.C体系进阶(四):juc-sync 同步器框架
    J.U.C体系进阶(三)- juc-atomic 原子类框架
    .net core https 双向验证
  • 原文地址:https://www.cnblogs.com/bhan/p/9725210.html
Copyright © 2020-2023  润新知