技术知识库

帮助中心 >  产品文档 >  云服务器 >  sshpass-Linux命令之非交互SSH

sshpass:用于非交互的ssh 密码验证,允许你用 -p 参数指定明文密码,然后直接登录远程服务器。 它支持密码从命令行,文件,环境变量中读取。


Ubuntu/debian系列的linux系统安装简单,直接apt-get就好了:


sudo apt-get install sshpass

centos系列的下载安装包,编译安装即可。



 ~ sshpass

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


   -h            Show help (this screen)

   -V            Print version information

At most one of -f, -d, -p or -e should be used

基本使用:



sshpass -p passwd  ssh  user@ip


提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: