ㅤㅤㅤ
ㅤㅤㅤ
ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ人生的游戏不在于拿了一副好牌,而在于怎样去打好坏牌,世上没有常胜将军,勇于超越自我者才能得到最后的奖杯
ㅤㅤㅤ
ㅤㅤㅤ
ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ
ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ
sshpass
ssh登陆不能在命令行中指定密码,需要用户交互输入密码,sshpass 的出现,解决了这一问题。它允许你用 -p 参数指定明文密码,然后直接登录远程服务器,
它支持密码从命令行、文件、环境变量中读取。所以,通过sshpass实现以非交互的形式为ssh提供密码
- ubuntu安装sshpass
sudo apt-get install sshpass
- 查看sshpass相关命令
sshpass -h
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters
-f filename Take password to use from file
-d number Use number as file descriptor for getting password
-p password Provide password as argument (security unwise)
-e Password is passed as env-var "SSHPASS"
With no parameters - password will be taken from stdin
-P prompt Which string should sshpass search for to detect a password prompt
-v Be verbose about what you're doing
-h Show help (this screen)
-V Print version information
At most one of -f, -d, -p or -e should be used
- 连接远程服务器
sshpass -p {password} ssh {username}@{ip} -p {port}

本文介绍SSHPass工具,用于解决SSH登录时的密码输入问题,实现自动化SSH登录过程。文章详细解释了SSHPass的安装、使用方法及参数选项,如从命令行、文件、环境变量读取密码。

6692

被折叠的 条评论
为什么被折叠?



