在Bash脚本中嵌入密码 [英] Embedding the Password in the Bash Script

查看:91
本文介绍了在Bash脚本中嵌入密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个测试脚本,该脚本需要将文件复制到目标嵌入式系统.但是,从脚本运行此将文件复制到远程目标系统的命令时,系统提示我输入目标板的管理员密码.我该如何以一种自动执行脚本的方式来使脚本自己(从脚本内部)自行选择密码,而不必每次运行脚本时都手动输入密码.

I am running a test script where files needs to be copied to the target embedded system.But when this command of copying the files to remote target system is run from the script I was prompted for the administrator password of the Target Board.How can I automate the script in such a way that the script will pick the password by itself(from within the script) and I don't have to put the password manually every-time i run the script.

脚本的摘录如下:

scp test.file1 <Target ip-address>:/home/bot21/test/.

Password is prompted when the above command is run.

推荐答案

正确的方法是使用基于密钥的身份验证. 了解它这里.

The right way to do this is with key-based authentication. Read about it here.

如果该链接曾经中断,只需在Google上搜索它即可:"ssh无密码"或"ssh密钥身份验证".尽管有Toby的评论,但我认为自己链接或指导如何进行搜索比重复别人可以说的更好,更深入的内容要好.

If that link ever breaks, just google it: "ssh passwordless" or "ssh key authentication". Despite Toby's comment, I think linking to or instructing how to search it yourself is better than repeating what others can say better and in more depth than I can.

这篇关于在Bash脚本中嵌入密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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