Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using dsh you can define the list of machines in ~/.dsh/machines.list in the form:

<user>@<host>

I'd like to have multiple hosts with different ssh ports, like this (I tried):

<user>@<samehost>:<onePort>
<user>@<samehost>:<anotherPort>
<user>@<samehost>:<yetAntherPort>

But dsh complains with a "Could not resolve hostname: user@samehost:onePort" for every line with the ":port".

I browsed the manual and there is no mention of "per line" port (there is just a global config), am I out of luck?

Thank you

share|improve this question
up vote 0 down vote accepted

You can actually create a ~/.ssh/config file to specify individual options (see man ssh for more options) for every host, eg:

Host myserver
    HostName 127.0.0.1
    User someuser
    IdentityFile ~/.ssh/some_id
    IdentitiesOnly yes

Host otherserver.net
    User root
    Port 5010

After creating that file you may modify your ~/.dsh/machines_list accordingly:

myserver
otherserver.net

Dsh should then work properly: dsh -a w

share|improve this answer
    
I think this is a good workaround (even if I'd rather have everything in the dsh config file), since I have many ports on the same host (they are ssh tunnels to other hosts) the .ssh/config would become: Host tunneled1 Host server User root Port <PORT1> Host tunneled2 Host server User root Port <PORT2> ... Host tunneledN Host server User root Port <PORTN> – atrent Jul 5 '15 at 4:23

dsh (dancer's shell): is it possible to specify ports in config file?

As far as I have tried, I'm afraid that the answer is: No.

Use pssh instead.

machines.pssh

localhost testuser
192.168.5.141:2317 quanta

then try something like this:

parallel-ssh -P -h machines.pssh w
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.