Re: ssh remote command

From: Adam Ophir Shapira (red_angel_at_techno-info.com)
Date: 05/28/03

  • Next message: dhiraj.2.bhuyan_at_bt.com: "X.509 and OpenSSH"
    Date: Wed, 28 May 2003 13:31:23 -0400
    To: moogy@securenet.net, secureshell@securityfocus.com
    
    

    I had the same problem as you at first. (Obviously, script-tameness
    wasn't a design-goal for any of the SSH protocols.)

    Then I searched, and followed the URL:
    http://atoms.vuse.vanderbilt.edu/Elements/CompMeth/Comp_Methods_ssh2.html

    I followed the instructions there to the letter, using <ssh-keygen>
    to generate the public and private key.

    The private key was saved onto "${HOME}/.ssh/id_dsa" on my local machine
    and the public key was saved as "${HOME}/.ssh/id_dsa.pub". I did not
    enter any passphrase (because as we both know, that isn't acceptable for
    scripting purposes).

    Then I went into my home directory on the local machine, and typed
    the following commands

    %> chmod -R g-rwx .ssh
    %> chmod -R o-rwx .ssh

    After that, I entered the ".ssh" directory, and then used SFTP to
    upload the "id_dsa.pub" file into the *remote* machine's ${HOME}
    directory, labeling it "tmp.txt" using the following command (after
    logging on via SFTP):
    > put id_dsa.pub tmp.txt

    Then I connected to the remote machine via SSH (shell access)
    and typed the following commands:

    %> mkdir -p .ssh
    %> cd .ssh
    %> cat ../tmp.txt >> authorized_keys
    %> rm ../tmp.txt

    That way, my local "${HOME}/.ssh/id_dsa.pub" became one line on
    the remote macine's "${HOME}/.ssh/authorized_keys":
    And ever since, I've had no problem.

    moogy@securenet.net wrote:

    >
    >
    >Hello
    >
    >I'm trying to do a command on a remote machine.
    >The user doesn't have a password. ( and can't do much also :) )
    >
    >I've generate a key on the local machine...
    >
    >my command is
    >
    >ssh -f bob@192.168.1.10 ls /
    >
    >I always get a prompt for a password.
    >I hit "SPACEBAR" then "RETURN"
    >and it works...
    >
    >But this is not acceptable for a script.
    >
    >Can I get some help...
    >
    >thank
    >
    >Jeremie
    >
    >
    >---------------------------------------------
    >This message was sent using SecureNet Mailman.
    >http://www.securenet.net/
    >
    >
    >
    >


  • Next message: dhiraj.2.bhuyan_at_bt.com: "X.509 and OpenSSH"

    Relevant Pages

    • Re: Ssh/Rsh problems
      ... > I am encountering problems with both ssh and rsh, ... > When I attempt to run a command on a remote machine via ssh, ...
      (comp.os.linux.security)
    • Re: Really need help on this one
      ... Is there a way to read the output of a particular command into ... Heres a better example using ssh. ... set timeout $timeout ... exec kill -9 $pid ...
      (comp.lang.tcl)
    • problem about executing a command without remote shell
      ... I want to execute a command on the remote machine with ssh client, ... But if I first login into the remote machine and then execute the same ...
      (comp.security.ssh)
    • Re: Execute script on remote computer
      ... a remote machine. ... Unix/Linux system and it's a relatively simple script that you want to ... you should just use the ssh command coupled with the name of the ...
      (comp.lang.python)
    • Re: OT: Hard disk mirror with Paragon on USB stick?
      ... at least two pages of intricate command line stuff. ... The password is only used when you want to backup to a remote machine ... via the network, using the ssh protocol. ... (e.g. with linux, ...
      (sci.electronics.design)