the usage of linux command "expect"
#! /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"的更多相关文章
- 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 ...
- 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( ...
- 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 ...
- [笔记]The Linux command line
Notes on The Linux Command Line (by W. E. Shotts Jr.) edited by Gopher 感觉博客园是不是搞了什么CSS在里头--在博客园显示效果挺 ...
- A Complete Guide to Usage of ‘usermod’ command– 15 Practical Examples with Screenshots
https://www.tecmint.com/usermod-command-examples/ -------------------------------------------------- ...
- linux command lynx
[Purpose] Learning linux command lynx [Eevironment] Ubuntu 16.04 terminal apt-get ...
- Linux command find All In One
Linux command find All In One $ find -h # find: illegal option -- h # usage: # find [-H | -L | -P] [ ...
- linux tcl expect 安装(转)
linux tcl expect 安装 一.Tcl安装 1. 下载:tcl8.4.20-src.tar.gz http://www.tcl.tk/software/tcltk/downloadnow ...
- 《The Linux Command Line》 读书笔记04 Linux用户以及权限相关命令
Linux用户以及权限相关命令 查看身份 id:Display user identity. 这个命令的输出会显示uid,gid和用户所属的组. uid即user ID,这是账户创建时被赋予的. gi ...
随机推荐
- Android成长日记-数据存储之SQLite[2]
Part one: 首先看这样一段代码 SQLiteDatabase db=openOrCreateDatabase("SQLDemo.db", MODE_PRIVATE,null ...
- [NOIP2012] 普及组
寻宝 大模拟 #include<iostream> #include<cmath> #include<algorithm> using namespace std; ...
- MongoDB安装,配置
安装 cd /usr/local/srcwget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.2.6.tgztar z ...
- 企业应用系统设计分享PPT
因今天上午需要为团队做一个分享,所以昨晚连夜写了一个<企业应用系统设计>的PPT,因为时间比较短,写的比较急.现在把PPT贴出来,做一个记录.同时也希望对大家有用. 文件我上传到了百度网盘 ...
- HDU 1811 Rank of Tetris(拓扑排序+并查集)
题目链接: 传送门 Rank of Tetris Time Limit: 1000MS Memory Limit: 32768 K Description 自从Lele开发了Rating系统, ...
- Git分支学习简记
简介 开始过了两遍Git的内容,第二天就已经忘记了分支(branch)的概念,开始还觉得不太用的到.然后又看了第二遍,才发现为什么大家说这个是Git里边极其重要的一个东西. 所谓branch,就类似于 ...
- CentOS 下安装
2016年12月5日15:25:58 ----------------------------------- 通常情况下在centos下安装软件就用yum. 关键是,使用yum你要知道安装包的名字是什 ...
- linux 下各文件夹的功能性介绍。(转载)
原文来自:http://www.cnblogs.com/wen858636827/archive/2012/12/26/2834373.html /opt 放置用户自己下载的软件 英文全称是op ...
- React Native 开发之 (06) JSX
一 React 1 React定义 React的GitHub地址是 https://github.com/facebook/react.它的官方介绍是 A JavaScript Library for ...
- JavaWeb---总结(十二)Session
一.Session简单介绍 在WEB开发中,服务器可以为每个用户浏览器创建一个会话对象(session对象),注意:一个浏览器独占一个session对象(默认情况下).因此,在需要保存用户数据时,服务 ...