zoukankan      html  css  js  c++  java
  • 服务器免密登陆脚本

    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

  • 相关阅读:
    题目一:使用Java实现二维数组中的查找
    算法的时间复杂度
    爬虫----爬虫存储库
    爬虫----爬虫解析库Beautifulsoup模块
    问卷调查
    爬虫----爬虫请求库selenium
    爬虫----爬虫请求库requests
    爬虫----爬虫基本原理
    python金融与量化分析------Matplotlib(绘图和可视化)
    Python与金融量化分析----金融与量化投资
  • 原文地址:https://www.cnblogs.com/bhan/p/9725210.html
Copyright © 2011-2022 走看看