vaniacer / sshto

Small bash script to manage your ssh connections. It builds menu (via dialog) from your ~/.ssh/config. It can not only connect but also to run commands, copy files, tunnel ports.
MIT License
595 stars 59 forks source link

Multiple 'Host' aliases are not handled gracefully #28

Open jg3 opened 10 months ago

jg3 commented 10 months ago

In the SSH config file, multiple space-separated entries on the Host line can resolve to the same set of configuration options. For example:

Host pear peach plum 
     Hostname %h.orchard.gardenparty.org
     user farmer
     IdentityFile ~/.ssh/id_rsa_orchard_20240109

In this case there are three different hostnames our farmer@ might want to get connected to with this private key and other settings. But sshto will only show the first host, pear, leaving no way within sshto for the user to connect to host peach or plum.

This is an enhancement request to render those space-separated aliases on the Host line as individual hosts.

One possible workaround would be for the user to manage a (far more verbose) .ssh/config file with a separate identical entry for each host. The challenge there is it would hamper adoption from users who have a maintained their config file manually, efficiently so far.

Another consideration is there are wildcard options for both the Host and Hostname parts of the configuration here that could expand beyond what sshto could possibly know from the config file, potentially making a need for another interactive dialog.

vaniacer commented 10 months ago

Hi, thank you for pointing into this, I'll check what could be done here.