I would like to automate ssh login from my Mac.
It does have a simple solution:
sshpass -p my_password ssh m_username@hostname
But my problem is installing sshpass on my Mac.
I would like to automate ssh login from my Mac.
It does have a simple solution:
sshpass -p my_password ssh m_username@hostname
But my problem is installing sshpass on my Mac.
There are instructions on how to install sshpass here:
https://gist.github.com/arunoda/7790979
For Mac you will need to install xcode and command line tools then use the unofficial Homewbrew command:
curl -L https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb > sshpass.rb && brew install sshpass.rb && rm sshpass.rb
Error: Calling Non-checksummed download of sshpass formula file from an arbitrary URL is disabled! Use 'brew extract' or 'brew create' and 'brew tap-new' to create a formula file in a tap on GitHub instead.
–
Eolic curl -L https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb > sshpass.rb && brew install sshpass.rb && rm sshpass.rb
–
Cabinet Update 2022: Unfortunately, Aleks Hudochenkov is no longer updating his repo. There are a bunch of other repos on GitHub that purport to contain a Homebrew recipe for sshpass. It's up to you which of them (if any) to trust.
Some years have passed and there is now a proper Homebrew Tap for sshpass
, maintained by Aleks Hudochenkov. To install sshpass
from this tap, run:
brew install hudochenkov/sshpass/sshpass
Tap source
Your CLT does not support macOS 11.
On latest version of Big Sur. –
Stockman sudo rm -rf /Library/Developer/CommandLineTools
and sudo xcode-select --install
. –
Alkmaar This repository has been archived by the owner. It is now read-only.
so I can't request bump its version to latest sshpass :( –
Vladamir brew install stevenhaddox/sshpass/sshpass
–
Cletuscleve sshpass
has to support ssh
versions to get it working. –
Enwomb There are instructions on how to install sshpass here:
https://gist.github.com/arunoda/7790979
For Mac you will need to install xcode and command line tools then use the unofficial Homewbrew command:
curl -L https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb > sshpass.rb && brew install sshpass.rb && rm sshpass.rb
Error: Calling Non-checksummed download of sshpass formula file from an arbitrary URL is disabled! Use 'brew extract' or 'brew create' and 'brew tap-new' to create a formula file in a tap on GitHub instead.
–
Eolic curl -L https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb > sshpass.rb && brew install sshpass.rb && rm sshpass.rb
–
Cabinet Another option in 2020 is this homebrew tap, maintained by esolitos
brew install esolitos/ipa/sshpass
authorized_keys
under home directories and that's why your staged public key was rejected, etc) –
Stonework Following worked for me
curl -O -L https://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz && tar xvzf sshpass-1.06.tar.gz
cd sshpass-1.06/
./configure
sudo make install
--insecure
to curl
if you get: SSL certificate problem: certificate has expired –
Sharl Solution provided by lukesUbuntu from github works for me:
Just use brew
$ brew install http://git.io/sshpass.rb
Error: Non-checksummed download of sshpass formula file from an arbitrary URL is unsupported!
brew extract` or brew create
and brew tap-new
to create a formula file in a tap on GitHub instead.` –
Vladamir I found that most of the answers listed here are out of date. To install the latest, I ran this and downloaded directly from sourceforge.net, based on other answers here.
curl -L https://sourceforge.net/projects/sshpass/files/latest/download -o sshpass.tar.gz && tar xvzf sshpass.tar.gz
cd sshpass-*
./configure
sudo make install
configure: error: in /Users/ME/sshpass-1.08: configure: error: C compiler cannot create executables See config.log for more details
–
Infest Please follow the steps below to install sshpass
in mac.
curl -O -L https://fossies.org/linux/privat/sshpass-1.06.tar.gz && tar xvzf sshpass-1.06.tar.gz
cd sshpass-1.06
./configure
sudo make install
/linux/privat/sshpass-1.09.tar.gz
–
Impeccant To avoid having to rely on unknown Github repositories (directly or via Homebrew taps) just use MacPorts :)
Just install MacPorts and then type
sudo port install sshpass
The idea is to install sshpass via MacPorts instead of Homebrew.
You can have both Homebrew and MacPorts on the same machine, but be careful as some packages are available on both sources, and in that case you should be consistent in order to avoid conflicts.
In such cases, normally I give priority to Homebrew, but sshpass won't be provided by them, as they explicitly say.
In fact, if you type:
brew install sshpass
Then the output will also include this sentence:
We won't add sshpass because it makes it too easy for novice SSH users to ruin SSH's security.
Then in this case MacPorts is the only choice (if you really want to use sshpass).
Link to the MacPorts project
How to install MacPorts
Link to the sshpass Port on MacPorts
I just followed the instructions from this article and it helped,
curl -O -L http://downloads.sourceforge.net/project/sshpass/sshpass/1.05/sshpass-1.05.tar.gz && tar xvzf sshpass-1.05.tar.gz
//This creates a directory sshpass-1.05
cd sshpass-1.05
./configure
make
sudo make install
For the simple reason:
Andy-B-MacBook:~ l.admin$ brew install sshpass
Error: No available formula with the name "sshpass"
We won't add sshpass because it makes it too easy for novice SSH users to
ruin SSH's security.
Thus, the answer to do the curl / configure / install worked great for me on Mac.
Just a slight update from the previous answer
curl -O -L https://fossies.org/linux/privat/sshpass-1.09.tar.gz && tar xvzf sshpass-1.09.tar.gz
cd sshpass-1.09/
./configure
sudo make install
This Worked as on OCT 2021
Aargh, the problem with the outdated links.
Simply go to https://sourceforge.net/projects/sshpass/
Download latest version and then tar xvzf
it and finally cd to the dir where it got unpacked
and install with:
./configure make sudo make install
I suppose this will also work on every OS with supported C sdk installed...
© 2022 - 2024 — McMap. All rights reserved.
ssh-keygen -b 2048
. It will generate a keypair and store them in~/.ssh.
asid_rsa
(private key) andid_rsa.pub
(public key). Copyid_rsa.pub
to linux in the directory~/.ssh/
and name the fileauthorized_keys
. From here on when you connect to linux you will not need a password. The private/public keypair will be used. – Feeleyid_rsa
file on your local machine and 2)scp
theid_rsa.pub
to the server's corresponding folder as suggested and 3) rename theid_ras.pub
file on the server. – Freebootssh-copy-id remoteuser@remotehostname
– Ratcliff