> Is there a way to make ssh automatically login with a password... (I
> realize this isn't very secure in terms of the workstation  but I am not
> worry about that for me)....
> 
> I tried doing someting like:
> 
> echo "password" | ssh -l user  site
> 
> but it doesn't seem to read the password..  (perhaps it doesn't look for
> input until after it has gone by).
> 
> I like using SSH for port forwarding.. I would like it to be able to login
> automatically and set up the tunnel -- from a  script/

You should use public key authentication for this instead of a password.

It works like this (these instructions are for ssh-2.4.0):

  - generate a DSA key for yourself by running (on the client)
      "ssh-keygen -P ~/.ssh2/scriptkey".  The -P option specifies empty
      passphrase so that it can be used in scripts.

  - Add line "IdKey scriptkey" to your ~/.ssh2/identification file (create
    the file if it doesn't already exist) (on the client)

  - Copy your public key file to the server:
      "scp ~/.ssh2/scriptkey.pub serverhost:.ssh2/scriptkey"

  - log into the server using your password

  - Edit .ssh2/authorization, and add the line "key acr.pub". (on the
    server)

  - Log out from the server.  Try logging into the server again.  You
    should now be able to log in without having to type a password.

After this, you can use Secure Shell from scripts to perform any tasks on
the remote host without having to worry about a password.

Note that the generated private key file "~/.ssh2/scriptkey" on the
client now serves as your authentication token.  It should be protected
with the same level of care as your password (or a script containing a
password).  (You can further increase security by using the "forced
command" feature, which is triggered by the "Command" keyword in the
.ssh2/authorization file on the server.  Its idea is to allow only a
predefined command to be executed on the server when logging in using a 
particular keu.  See "man ssh2" for more information.)

    Tatu

Reply via email to