使用sshpass
sshpass -p "password" scp -r user@example.com:/some/remote/path /some/local/path
所以密码在bash历史记录中没有显示。
sshpass -f "/path/to/passwordfile" scp -r user@example.com:/some/remote/path /some/local/path
上面的内容复制路径的内容从远程主机到您的本地。
安装:
- Ubuntu/Debian
apt install sshpass
- CentOS/fedora
yum install sshpass
- Macw/macport
port install sshpass
- Macw/BREW
brew instal