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

  • 相关阅读:
    <自动化测试>之<使用unittest Python测试框架进行参数化测试>
    <自动化测试>之<unittest框架使用1>
    <自动化测试>之<selenium API 查找元素操作底层方法>
    <自动化测试>之<selenium API 用法2>
    <自动化测试>之<Selenium API 的用法1>
    <Jmeter入门不放弃>之<3.两种常见录制脚本的方法>
    <Jmeter入门不放弃>之<2.常用功能>
    <Jmeter入门不放弃>之<1.认识jmeter>
    <自动化测试>之<SeleniumIDE使用详解 >
    sql 注入get与post模式语句
  • 原文地址:https://www.cnblogs.com/bhan/p/9725210.html
Copyright © 2011-2022 走看看