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

查看:16
本文介绍了在 shell 脚本中使用 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 脚本 scp 从本地到学校主目录的整个 ~/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?

这里是关于如何设置密钥的非常详细的指南p>

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

推荐答案

ssh key 不被允许?这将是一个更好的解决方案.

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

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

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