cmv has asked for the wisdom of the Perl Monks concerning the following question:
I can't explain this and need guidance from wiser minds - please help.
Here’s how to reproduce:
1.) Setup ssh public/private keys so that this unix shell command works without you having to enter a password:
$ ssh usr@remotehost date
2.) Run these command from your unix shell prompt - why does one FAIL (ask for password), while others don’t?
You can replace system with exec and get the same result.$ perl -e 'system("ssh usr\@remotehost date”)’ # works $ perl -e 'system("ssh -l usr remotehost date")’ # works $ perl -e 'system("ssh", "usr\@remotehost", "date”)’ # works $ perl -e 'system("ssh", "-l usr", "remotehost", "date”)’ # FAILS
Thanks
-Craig
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strange SSH Behavior via system or exec
by choroba (Cardinal) on Sep 18, 2014 at 15:08 UTC | |
by cmv (Chaplain) on Sep 18, 2014 at 15:20 UTC | |
by salva (Canon) on Sep 18, 2014 at 15:26 UTC | |
by jellisii2 (Hermit) on Sep 18, 2014 at 16:31 UTC | |
by Anonymous Monk on Sep 18, 2014 at 16:40 UTC | |
by Anonymous Monk on Sep 18, 2014 at 16:57 UTC |