the-bastion icon indicating copy to clipboard operation
the-bastion copied to clipboard

Add automaticaly the port number when connecting to a host with a different ssh port

Open deepbluemussel opened this issue 3 years ago • 2 comments

When connecting to a host with a different standard port, you have to specify the port number. It would be more convenient if the port is added to the ssh command depending on the server you want to connect to.

deepbluemussel avatar Feb 23 '21 19:02 deepbluemussel

Currently the way it works, is the user asks to connect somewhere, the bastion checks whether this is allowed or not, and takes decision based upon this. This behavior has to stay by default, because that's also how SSH works (if you don't specify a port, it always defaults to 22). However we could imagine a cmdline switch that, in the absence of an explicitly specified port, would try to find a matching allowed server with a non-22 port. This cmdline switch could be added, by the users, directly in their bastion alias if they'd like to use this behavior all the time. I didn't check yet whether this would be easy to implement or not, but would something like that work for you?

speed47 avatar Feb 26 '21 13:02 speed47

This is exactly the kind of solution I had in mind. At each ssh connection attempt, the command would list the available connections and automatically add the associated port. Right now I'm using aliases to add the non-standard port and only a couple of instances uses port 22 so that's not a blocking issue, just to add more convenience.

deepbluemussel avatar Feb 28 '21 13:02 deepbluemussel