[GH-ISSUE #152] Add automaticaly the port number when connecting to a host with a different ssh port #31

Open
opened 2026-05-07 00:17:51 +02:00 by BreizhHardware · 2 comments

Originally created by @deepbluemussel on GitHub (Feb 23, 2021).
Original GitHub issue: https://github.com/ovh/the-bastion/issues/152

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.

Originally created by @deepbluemussel on GitHub (Feb 23, 2021). Original GitHub issue: https://github.com/ovh/the-bastion/issues/152 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.
Author
Owner

@speed47 commented on GitHub (Feb 26, 2021):

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?

<!-- gh-comment-id:786660050 --> @speed47 commented on GitHub (Feb 26, 2021): 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?
Author
Owner

@deepbluemussel commented on GitHub (Feb 28, 2021):

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.

<!-- gh-comment-id:787455201 --> @deepbluemussel commented on GitHub (Feb 28, 2021): 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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/the-bastion#31
No description provided.