robskillington / pdsh

Automatically exported from code.google.com/p/pdsh
GNU General Public License v2.0
0 stars 1 forks source link

Do not pass -l%u to ssh in sshcmd.c if not explicitly defined #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently pdsh's sshcmd.c module always passes the -l option to the ssh 
commands, even if the user did not defined it. In ordinary test cases it won't 
cause a problem, but if the user uses .ssh/config with User option specified, 
the option in the config file will be omitted. 

The purpose of -l option in ssh command line is to override the local or 
configured value for username to send. That is why it is a bad idea to always 
explicitly call the ssh commands with -l option. However it is a nice thing to 
implement the -l override mechanism in pdsh, let the ssh command and it's 
internal mechanism to decide what username to send, because that's what the 
user expects. 

Mark is currently fixing the usage PDSH_SSH_ARGS environment variable which 
supplies a workaround for the problem described above, but in my point of view 
this should be the default behaviour.

The conversation led to this request can be found in Issue 39.

V. Kandasamy

Original issue reported on code.google.com by neuebede...@gmail.com on 4 Oct 2011 at 4:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks for opening this request. I can't think of any reason not to leave
-l%u off the default ssh args now that the code adds it when necessary
(i.e. when ruser != luser)

Can you try the attached patch?

Original comment by mark.gro...@gmail.com on 4 Oct 2011 at 10:30

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

I applied the patch on the (clean) source, and recompiled the code. Now it 
works as described above. 

I tested the following cases:

1. ruser != luser but ruser defined in ssh config
Works well.

2. ruser != luser but ruser NOT defined in ssh config
Works as expected. Explicit -l is needed at pdsh command line to log in.

3. ruser != luser but ruser defined in ssh config, AND overriding it with pdsh 
-l option
Works as expected, pdsh's -l overrides ssh config. Without the explicit pdsh -l 
it reads the username from the ssh config.

4. Putting back the -l%u in the PDSH_SSH_ARGS environment variable brings back 
the old behaviour of handling the username.

Is there any possibility to apply this patch on the future releases? Let's say 
2.28 ;)

Regards,

Vish

Original comment by neuebede...@gmail.com on 5 Oct 2011 at 9:09

GoogleCodeExporter commented 9 years ago
Hi,

in addition:

5. Tested using dshgroups modules, with -g option.

Original comment by neuebede...@gmail.com on 5 Oct 2011 at 9:11

GoogleCodeExporter commented 9 years ago
Yes, I plan to add this to pdsh-2.28

Original comment by mark.gro...@gmail.com on 5 Oct 2011 at 8:41

GoogleCodeExporter commented 9 years ago
This issue was updated by revision aabc5bff1a77.

The -l%u argument to ssh is now added when remote username is
different from local username, so it no longer needs to be
in the default argument list.

Original comment by mark.gro...@gmail.com on 19 Oct 2011 at 5:41

GoogleCodeExporter commented 9 years ago

Original comment by mark.gro...@gmail.com on 2 Nov 2011 at 11:07