linux - 使用批处理文件从 Windows 系统登录 Linux 服务器

标签 linux batch-file expect

我想制作一个自动远程登录系统的脚本。 我必须从我的系统 (Windows Xp) 访问我的服务器 (Linux)

spawn telnet <machine ip> expect "login:" send "<username>\n" expect "Password:" send "<password>\n"

上面的脚本是否正确? 1)如果是,我如何从我的机器(WindowsXp)访问这个脚本? 2) 如果是,我必须安装 expect 包吗?

最佳答案

使用 ssh 代替 telnet 并使用公钥/私钥进行身份验证。 然后使用带有命令行参数的腻子无需密码即可登录。

http://www.howtoforge.com/how-to-configure-ssh-keys-authentication-with-putty-and-linux-server-in-5-quick-steps

关于linux - 使用批处理文件从 Windows 系统登录 Linux 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1339877/

相关文章:

linux - 查找两个文件夹之间的共同文件

linux - 期望脚本 + 期望错过发送字符串 + 延迟问题

powershell - 将 %* 从批处理脚本作为 $args 传递给 powershell 脚本时转义参数

windows - 为什么 REG DELETE 命令在此批处理脚本中失败?

ssh - 未提供用于ssh登录的密码

exception - 期望脚本-引发异常

linux - 如何在 Linux 中打开/切换到第 10 个 screen session ?

linux - 打开 "An error was encountered while saving the command history"Matlab报错

batch-file - 使用批处理文件获取 'MB' 目录的大小

linux - else 字符串匹配在 expect 中