mercuryshipz has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: ssh help
by halley (Prior) on Feb 06, 2008 at 17:07 UTC
    Just as in your previous question, scp perl, I'm at a loss to see how this is at all related to Perl?
    Cannot write to a directory.
    I would imagine that the following command would give the following output:
    % ssh username:password@remoteserver file /users/merc/tmp /users/merc/tmp: directory
    There are probably better places, such as IRC channels, to get handholding through Unix shell exercises. While there are many people from many backgrounds with deep knowledge in many things, it really is Perlmonks, not Sshmonks. No offense.

    [ e d @ h a l l e y . c c ]

Re: ssh help
by moritz (Cardinal) on Feb 06, 2008 at 16:57 UTC
    ksh: /users/merc: 0403-005 Cannot create the specified file.

    Are you sure that there is no directory with this name? (Update: It seems that this path is a directory. Well, then you can't use it as a normal file).

    The Execute permission denied could be caused by a file system that is mounted with the noexec-option.

Re: ssh help
by quester (Vicar) on Feb 07, 2008 at 07:32 UTC
    Actually, this has nothing to do with ssh either... it's just a Unix problem. You are trying to redirect the output of cat into a directory. If you copied the file, cp would know the input file name and could use it to create the output file. Redirection with ">" doesn't do that... you have to tell it the name of the file explicitly. I think you can just change:
    cat > /users/merc/tmp
    cat > /users/merc/tmp/

    By the way... why are you chmod'ing /users/sword/tmp just before you execute it? Did you mean /users/merc/tmp?

    Also, if you want to remove the you need to put the command in,

    rm /users/merc/tmp/
    Hmm... you have the same file name on both systems... remember to back up the file to a different name in case the rm ever gets executed on the wrong one. Even better, change the name on one system or the other.

    Another, possibly simpler, approach would be to just have perl execute its own standard input, so you don't need to use a temporary file at all,

    perl -w -

      hi guys... this what i did... i first setup the ssh public and private keys for the 2 servers... so that the passwords are not typed... and then wrapped it in a shell script and ran it on the server i am workin on...
      for setting up ssh keys...
      SSH Setup

      #!/bin/sh scp /users/sword/ user@remoteserver:/users/sword/tmp/pars_r result=$(ssh cuser@remoteserver perl /users/sword/tmp/ echo $result ssh user@remoteserver rm /users/sword/tmp/

      just in case if somebody needs it... thanks again for ur support guys...