mac下安装sshpass

这篇博客介绍了如何在macOS上通过本地下载安装sshpass,包括下载安装包、解压、编译源码安装及检测安装成功的步骤。由于macOS的安全限制,直接在线安装可能遇到问题,作者建议使用本地安装法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下载到本地安装

  • 下载安装包
https://sourceforge.net/projects/sshpass/
  • 解压并切换到安装包目录
tar -zxvf sshpass-1.08.tar.gz
cd sshpass-1.08
  • 检验环境
./configure
  • 编译源码安装
make&&make install
  • 检测安装是否成功
▶ 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

   -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

在线安装

brew install sshpass

macOS新版本中由于安全原因无法直接使用此方法安装,需要采用其它安全的办法绕过。

brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb

由于你懂的原因,我两种方式都安装失败了,所以推荐下载到本地的安装方式

▶ brew install sshpass
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "sshpass".
We won't add sshpass because it makes it too easy for novice SSH users to
ruin SSH's security.
▶ brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
Traceback (most recent call last):
`brew extract` or `brew create` and `brew tap-new` to create a formula file in a tap on GitHub instead.: Invalid usage: Non-checksummed download of sshpass formula file from an arbitrary URL is unsupported!  (UsageError)
`brew extract` or `brew create` and `brew tap-new` to create a formula file in a tap on GitHub instead.: Invalid usage: Non-checksummed download of sshpass formula file from an arbitrary URL is unsupported!  (UsageError)

参考文档

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值