You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How could I use this to set a certain ssh port?? #151
Hi. I'm using deepspeed and it's using pdsh to connect different machines. I have two machines and have dockers running in them. When I use ssh between two docker containers, I need to set a certain port expose to the host, like "-p 19022:22" when running a container. Then I can visit this container in another container in another machine by"ssh root@xxx.xxx.xxx.xxx -p 19022". Now the problem is if I use pdsh, the command is like "pdsh -w ssh:xxx.xxx.xxx.xxx date" and it fails to make connection. Because I can't set a certain port. How could I solve this? Thanks in advance.
The environment variable PDSH_SSH_ARGS_APPEND can be used to append arguments to the ssh command spawned by pdsh. Thus, you can try PDSH_SSH_ARGS_APPEND="-p19022 pdsh .... However, this assumes all target hosts use the same port.
If the port mapping stay the same, an easier and more flexible approach may be to configure aliases in your .ssh/config file, e.g.
Host container1
HostName realhostname
Port 19022
Host container2
HostName realhostname
Port 19023
Then I think you'll be able to use pdsh as just pdsh -w container[1-2] command (Though I didn't have a chance to test this.)
On 8/14/23 07:53, Mark Grondona wrote:
The environment variable |PDSH_SSH_ARGS_APPEND| can be used to append arguments to the |ssh| command spawned by pdsh. Thus, you can try |PDSH_SSH_ARGS_APPEND="-p19022 pdsh ...|. However, this assumes all target hosts use the same port.
If the port mapping stay the same, an easier and more flexible approach may be to configure aliases in your |.ssh/config| file, e.g.
|Host container1 HostName realhostname Port 19022 Host container2 HostName realhostname Port 19023 |
Then I think you'll be able to use pdsh as just |pdsh -w container[1-2] command| (Though I didn't have a chance to test this.)
—
Reply to this email directly, view it on GitHub <#151 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AFNEP7WJWOTL7DTGKUBDMRLXVIUUVANCNFSM6AAAAAA3PK4JMM>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
ezekielqu,
I also use some ProxyCommand stuff to disassemble an alternate jump-pathing syntax: (you can't do this in the newer ProxyJump directive, which is simpler for most use cases, but i hope they never deprecate ProxyCommand for just this type of use)
Host *!!*
LogLevel=ERROR
ProxyCommand $(h="%h";p="%p" ; echo ssh -o 'LogLevel=ERROR' -W ${h##*\!\!}:%p -l root ${h%%\!\!*})
(LogLevel=ERROR to disable login banners i have to put on these systems)
That lets me go via Gateways like so:
ssh cluster3_head_node!!node43
(yeah, i use root for the proxy connection in this case). I used to use '::' as a DECnet style delimiter, but at the time, 'scp' didn't allow that, and '!' was an accepted - but not builtin host-acceptable character.
e.g.
$ gpdsh -w 'c5-int1!!node[8,9]' uptime
c5-int1!!node8: 15:26:02 up 65 days, 16:59, 0 users, load average: 0.00, 0.00, 0.00
c5-int1!!node9: 15:26:02 up 65 days, 23:26, 0 users, load average: 0.00, 0.00, 0.00
$ pdsh -w 'c5-int1!!node[8,9]' hostname
c5-int1!!node9: node9
c5-int1!!node8: node8
One thing you must take care of if you use a common gateway host (e.g. 'c5-int1!!node[1-128]'), you will likely hit the default 'sshd' MaxStartups limit. this is a throttle to avoid DDoS attacks. By default, this usually results in the first 10 back-end nodes going to completion, then random number of remaining nodes failing to appear at all. (i think this generates "refused connection"). I just set my PDSH FANOUT to 10 or so to reduce the simultaneous client hits.
Someone else (Mike Hommey <mh (at) glandium (dot) org>. ) had independently come up with a much more "complex/featureful" solution that DOES handle arbitrary host+port combos in the encapsulating syntax:
https://glandium.org/blog/?p=3631
Host *+*
ProxyCommand ssh -W $(echo %h | sed 's/^.*+//;s/^\([^:]*$\)/\1:22/') $(echo %h | sed 's/+[^+]*$//;s/\([^+%%]*\)%%\([^+]*\)$/\2 -l \1/;s/:\([^:+]*\)$/ -p \1/')
e.g.:
ssh login1%host1:port1+login2%host2:port2+login3%host3:port3+host4:port4 -l login4
You might be able to put that in your ~/.ssh/config and use some WCOLL entries using that pathing syntax to do what you want.
Activity
grondo commentedon Aug 14, 2023
The environment variable
PDSH_SSH_ARGS_APPENDcan be used to append arguments to thesshcommand spawned by pdsh. Thus, you can tryPDSH_SSH_ARGS_APPEND="-p19022 pdsh .... However, this assumes all target hosts use the same port.If the port mapping stay the same, an easier and more flexible approach may be to configure aliases in your
.ssh/configfile, e.g.Then I think you'll be able to use pdsh as just
pdsh -w container[1-2] command(Though I didn't have a chance to test this.)sdowdy commentedon Aug 14, 2023