There are two ways I manage, or have seen people manage, SSH data:
Good 'ole, command line, plain text, ssh_config file.
Create a file called config
inside ~/.ssh
. You can specify global parameters by putting them above any host declarations. When I started using MacPorts, I had to explicitly define a default SSH Private Key to use automatically when connecting, so as the very first line of the file I put;
IdentityFile ~/.ssh/id_rsa
When you define custom rules for hosts (and you can even use * as a wildcard), it looks something like this:
Host prod-*
User jason
Port 2222
LocalForward 5901 localhost:5901
IdentityFile ~/.ssh/work-id_rsa
Then when I run ssh prod-script
for example, all the rest of the rules get applied automatically.
A lot of people who don't want to manually manage all their stuff in such a cumbersome manner quickly find JellyfiSSH. (Mac App Store Link. The same people also became very annoyed when it stopped being downloadable for free.)
JellyfiSSH gives you GUI access to almost everything that can be specified in the command line or ssh_config file. JellyfiSSH is just a configuration storage app for organization purposes, because it generates the commands based off the options you set and upon clicking connect, opens a new terminal window with all of your options defined on the command line. JellyfiSSH is not a terminal app on it's own.
Check .ssh/id_rsa and make sure you still have these lines on top and bottom:
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
They are crucial to the functionality of the SSH PubKeyAuth setup. Looking at the output from your debug, it appears that SSH is complaining about not knowing what type of key it is, which is defined by the first line. Likewise, after considering this, I removed the first line from my own private key, and SSH suddenly started bugging me to enter my passphrase for the key.
If this solution doesn't work, I'm afraid your only option will most likely be to re-generate your key pair.
Best Answer
Yes, it is possible - there are a number of ways to do this.
You can install the program "csshx" from HomeBrew which is specifically designed for this purpose. First you'll need to have HomeBrew installed, and then run this command to install csshx:
Then you can run csshx like this:
where serverX should be replaced with the actual hostnames of your servers.
That will display three graphical macOS windows with the output from each of the servers, and a fourth window with a red background, where you enter your commands. These commands are then sent to all three servers.
A different approach is to use "tmux". It is a common application for Terminal usage that have many advantages, and one of them is that it allows parallel execution. In general it allows for having multiple shell sessions within one Terminal tab - for example you can have three shells with connections to different servers each in their own pane, but all in the same macOS window/tab.
Again you'll need to have HomeBrew installed, and then run this command to install:
You can then run
tmux
to start the program. Open a pane for each you want to connect to, and ssh into them as you would normally do. When you're ready to execute commands on all servers at once, press Ctrl-B and then:Now everything you write will be written to all the panes.
You need to press Ctrl-B and run:
to disable the feature again.