Hi,

I was trying to embed a ssh key in a script and pass it via stdin
(unfortunately not directly supported by ssh). Investigating ways how
this can be done, I ran into a curiosity. With bash, the following does
about what I need:

  #!/bin/bash
  ssh -i /dev/stdin luser@localhost ls  <<EOF
  -----BEGIN RSA PRIVATE KEY-----
  ....

Trying to do the same thing with perl:

  #!/usr/bin/perl
  open STDIN, ">&DATA";
  exec "ssh -i /dev/stdin luser\@localhost ls";
  __END__
  -----BEGIN RSA PRIVATE KEY-----
  ....

does _not_ work - ssh will complain "Permissions 0755 for '/dev/stdin'
are too open" (which is not true anyway) and refuse to use the key.

Does somebody have a good explanation for this different behavior?
I thought, from the perspective of ssh both variants should be
equivalent ...

Regards,
                     Peter


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to