[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[问题求助] SCP 如何将密码直接输入在命令中,没有交互过程

SCP 如何将密码直接输入在命令中,没有交互过程,如下:

#!/bin/bash
# Rest configuration
read -p "please input Agile Controller IP address:" ac_ip
echo $ac_ip
acRest_path="/opt/AC"
eSightRest_path="/opt/oneKey"
rootPWD="Changeme_123"
echo $rootPWD | scp root@$ac_ipacRest_path/aaa.txt $eSightRest_path/
sudo chown ossuserssgroup $eSightRest_path/aaa.txt
chmod 600 $eSightRest_path/aaa.txt

上面代码还是会跳出出入密码的界面,求各位大神帮忙看看!

方法1:建立ssh信任,以后scp的时候就不需要密码了。
-----怎么建立ssh信任?

TOP

返回列表