如何使用Linux脚本自动传递SFTP并传递PEM密钥密码短语?
我正在尝试创建一个可以调用的Linux脚本,该脚本可以使用具有关联密码的PEM密钥自动进入外部服务器?
据我所知,它大致类似于:
sftp -i rsa_private.pem -p rsa_private_pass_passpphrase用户名@ip_address@ip_address,
但显然这是在SFTP帐户的假定密码中传递的,而不是PEM键...我是我的...相对不经验Linux脚本,因此任何帮助都将不胜感激!
I'm trying to create a linux script that can be called to automatically sftp into an external server using a pem key which has an associated passphrase?
As far as I can tell it would be roughly something like:
sftp -i rsa_private.pem -p rsa_private_passphrase username@ip_address
But obviously this is passing in an assumed password for the sftp account and not for the pem key... I'm relatively inexperienced with linux scripting so any help at all would be highly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这个棘手的解决方案:
如何通过环境变量传递SSH键密码
基本上,您必须遵循以下步骤:
安装SSH-Agent First
创建一个包含密码
的Shell Script AskPass.sh,从您的SFTP脚本中启动SSH-Ancent并启动Helper Script
Try this tricky solution :
How to pass an ssh key passphrase via environment variable
basically , you have to follow these steps :
install ssh-agent first
Create a shell script askpass.sh containing the passphrase
From your sftp script , start ssh-agent and launch the helper script