Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How could I use this to set a certain ssh port?? #151

Open
ezekielqu opened this issue Aug 14, 2023 · 2 comments
Open

How could I use this to set a certain ssh port?? #151

ezekielqu opened this issue Aug 14, 2023 · 2 comments

Comments

@ezekielqu
Copy link

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 [email protected] -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.

@grondo
Copy link
Member

grondo commented Aug 14, 2023

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.)

@sdowdy
Copy link

sdowdy commented Aug 14, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants