---
title: "脚本登录远端服务器并执行命令"
author: "xiaocao000"
date: "2014-07-10T12:52:16Z"
tags: []
categories: ["操作系统"]
slug: "untitled"
draft: false
lastmod: "2014-07-10T12:52:16Z"
id: 2090323
url: "https://xiaocao000.iteye.com/blog/2090323"
---

#!/bin/sh set timeout 30 spawn ssh @ expect { "\*yes/no\*" { send "yes\\r"; exp\_continue} "\*Password:\*" {send "password\\r"} } expect "\*#\*" send "pss\\r" interact