我想通过 SSH 连接到远程机器,但不想输入密码,而是想从另一个文件重定向它。
所以我有一个password.txt
存储密码的文件。File.sh
是我的 bash 文件。
在 File.sh
#!/bin/bash
ssh -T user@10.2.5.1
Run Code Online (Sandbox Code Playgroud)
在执行文件时,我做了:
./File.sh < password.txt
Run Code Online (Sandbox Code Playgroud)
但我还是被要求输入密码。
如何从文件中获取要输入的密码?
这是输出 cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 78
model name : Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
stepping : 3
microcode : 0x74
cpu MHz : 2400.000
cache size : 3072 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de …
Run Code Online (Sandbox Code Playgroud)