Re: ssh remote command
From: Adam Ophir Shapira (red_angel_at_techno-info.com)
Date: 05/28/03
- Previous message: wjnorth: "RE: SCP help"
- In reply to: moogy_at_securenet.net: "ssh remote command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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/
>
>
>
>
- Previous message: wjnorth: "RE: SCP help"
- In reply to: moogy_at_securenet.net: "ssh remote command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|