#! /usr/bin/expect -f
# this script is used to practise the command "expect"

#when "lindex" have been used here, the array index begins with 0 but not with 1
set user [lindex $argv 0]
set host [lindex $argv 1]
set passwd [lindex $argv 2]
set timeout 10

spawn ssh $user@$host
# expect "[yes/no]" {send "yes\r"}  if 'ssh-ing' a server for the first time,

# you most likely encounter the case above concerning RSA
expect "password:" {send "$passwd\r"}
interact

# modify the script mode to be 0744

# now, one runs "./login.exp your_name host_name your_passwd" in the bash shell, logging in the server successfully.

the usage of linux command "expect"的更多相关文章

  1. 15 Examples To Master Linux Command Line History

    When you are using Linux command line frequently, using the history effectively can be a major produ ...

  2. 10 Interesting Linux Command Line Tricks and Tips Worth Knowing

    I passionately enjoy working with commands as they offer more control over a Linux system than GUIs( ...

  3. 5 commands to check memory usage on Linux

    Memory Usage On linux, there are commands for almost everything, because the gui might not be always ...

  4. [笔记]The Linux command line

    Notes on The Linux Command Line (by W. E. Shotts Jr.) edited by Gopher 感觉博客园是不是搞了什么CSS在里头--在博客园显示效果挺 ...

  5. A Complete Guide to Usage of ‘usermod’ command– 15 Practical Examples with Screenshots

    https://www.tecmint.com/usermod-command-examples/ -------------------------------------------------- ...

  6. linux command lynx

    [Purpose]        Learning linux command  lynx   [Eevironment]        Ubuntu 16.04 terminal   apt-get ...

  7. Linux command find All In One

    Linux command find All In One $ find -h # find: illegal option -- h # usage: # find [-H | -L | -P] [ ...

  8. linux tcl expect 安装(转)

    linux tcl expect 安装 一.Tcl安装 1.  下载:tcl8.4.20-src.tar.gz http://www.tcl.tk/software/tcltk/downloadnow ...

  9. 《The Linux Command Line》 读书笔记04 Linux用户以及权限相关命令

    Linux用户以及权限相关命令 查看身份 id:Display user identity. 这个命令的输出会显示uid,gid和用户所属的组. uid即user ID,这是账户创建时被赋予的. gi ...

随机推荐

  1. BZOJ 1110: [POI2007]砝码Odw

    1110: [POI2007]砝码Odw Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 547  Solved: 296[Submit][Status ...

  2. oracle大数据量。表分区提示查询效率

    现在业务有一张usertrack 日志记录表.每天会产生30万条数据.数据量大查询效率会非常慢 所以我考虑通过表分区来提示效率  逻辑上是一张表.但是分区后会按照分区条件将数据分在不同的物理文件 优点 ...

  3. UOJ147 斗地主

    题目描述 牛牛最近迷上了一种叫斗地主的扑克游戏.斗地主是一种使用黑桃.红心.梅花.方片的A到K加上大小王的共54张牌来进行的扑克牌游戏.在斗地主中,牌的大小关 系根据牌的数码表示如下:3<4&l ...

  4. 关于git SSH Key的 生成

    最近刚接触git,简直就是一小白用户,所以决定自己记录一些东西,以备不时之需 系统环境:Windows 1.首先下载git,http://git-scm.com/download/ 2.正常安装git ...

  5. 心血来潮学python

    第一次见python就被吸引了,嗯,前面在linux下调试过一些小段代码.最近工作都在windows下面,也懒得换去unbuntu,所以想着在win下安装python. 之前不知道用什么方法装的pyt ...

  6. cantor三分集

    值得一提的是,第一次听说cantor三分集是在数字电路课上,然而数电是我最不喜欢的课程之一...... 分形大都具有自相似.自仿射性质,所以cantor三分集用递归再合适不过了,本来不想用matlab ...

  7. UVA 11419SAM I AM(输出 最小覆盖点 )

    参考博客:如何找取 最小覆盖点集合 题意:R*C大小的网格,网格上面放了一些目标.可以再网格外发射子弹,子弹会沿着垂直或者水平方向飞行,并且打掉飞行路径上的所有目标,计算最小多少子弹,各从哪些位置发射 ...

  8. 分析setting源代码获取sd卡大小

    分析setting源代码获取sd卡大小 android系统有一个特点,即开源,我们可以得到任何一个应用的源代码,比如我们不知道这样的android代码怎么写,我们可以打开模拟器里面的设置(settin ...

  9. jquery 中的 return false 不起作用

    jquery  中的 return false 不起作用 $(".lcId").each(function(e) { if ($(this).attr("checked& ...

  10. kaili camera

    #lsusb #dmesg | grep uvc #apt-get install guvcview cheese