linux远程注入pdf,用Expect实现Linux自动远程登陆.pdf

用Expect实现Linux自动远程登陆

NETWORKANDCOMMUNICAⅡ0N 网络与通信

用Expect实现 Linux自动远程登陆

徐冰

(德州职业技术学院,山东 德州 253034)

摘 要:利用Expect和SSH,实现 自动输入密码实现远程登录,从而简化登录过程中由于输入密码或输 出密码造成

的时间浪费,并在大规模系统中可以通过脚本来实现远程操作,从而实现多机之间的协同交互。

关键词:远程登录 ;自动登录 ;远程操作 ;SSH协议 ;Expect工具

AutoRemoteLoginwithExpect

XU Bing

(DezhouVocationalandTechnicalCollege,ShnadongDezhou,253034,China)

Abstract:Thisarticleimplementremotelogin andremoteoperationwithexpectbywhichwecaneasilylogintoremote

machineandalsocandosomeremoteoperation.

Keywords:RemoteLogin;AutoLogin;RemoteOperation;SSH agreement;Expecttool

随着 Linux的流行 .在当前软件领域远程登录和远程操作 echo”Usage:、basename$0、 [一a] [一d】 一【Pport] -【p

变得 越来越 常见 ,有非 常著名 的远程登 录软件如 telnet, password] 一【ttimeout] < [user@】ip> c【ommnad]”

echo ” 一a :runremotecommandasadmin”

rlogin。ssh,其 中以ssh最为常用和安全 。但是传统的 ssh进

echo” 一d:echodebuginfoexceptpasswd”

行远程登录或操作时需要用户在终端输入密码来认证用户信

echo” 一Pport:defaultportis22,youcanchangeitwith

息,这大大降低了ssh的易用性。通过 expect来对 ssh进行包 hteoption’’

装 .在不丧失安全性 的同时获得极大 的易用性 ,从而大大提 echo _ppassword :defaultpasswordisdefined in 一/.pwd

高远程登录和远程操作 的效率 ,并使得远程操作脚本化成为 file.everysuccessloginwillupdatethepasswordin一|.pwdfile。

可能。从而极大提高脚本的远程交互能力 。 echo”-ttimeout:defaulttimeoutiS1200second (20m)”

echo u【ser]@ip:defaultloginuseriscurrentlocaluser

l 使用技术

echo ” command :

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值