Skip to content

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

Open

Description

@ezekielqu

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.

Activity

  1. grondo commented on Aug 14, 2023

    @grondo
    Member

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

  2. sdowdy commented on Aug 14, 2023

    @sdowdy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions