在外壳程序脚本中使用SCP时如何响应密码提示? [英] How to respond to password prompt when using SCP in a shell script?

查看:100
本文介绍了在外壳程序脚本中使用SCP时如何响应密码提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我很清楚有关此主题的许多问题.我已经阅读了它们,但仍然可以为我的情况找到合适的答案.

First of all, I am well aware of that there are many of questions regarding this topic. I have read them, but still could figure out an appropriate answer for my situation.

我想使用Shell脚本从本地到学校家庭目录的整个~/cs###/assign1目录.我的问题是,脚本中是否可以等待密码提示,然后模拟键盘事件以键入"密码?

I would like to scp the entire ~/cs###/assign1 dir from local to school home dir with a shell script. My question is, is there a way in my script to wait for the password prompt, and then simulate key board event to 'type' in my password?

此处是有关如何设置密钥的非常详细的指南

here is a really detailed guide of how to set up the key

推荐答案

是否允许使用ssh密钥?那将是一个更好的解决方案.

Are ssh keys not allowed? That would be a better solution.

这篇关于在外壳程序脚本中使用SCP时如何响应密码提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆