in reply to SSH Help

if you just want to copy files you can set up public-key authentication, so you won't be prompted for a password.
keep in mind that you can use scp just like cp but with a special syntax for remote files (like the rcp syntax).

Replies are listed 'Best First'.
Re^2: OT - SSH Help
by smullis (Pilgrim) on Oct 29, 2004 at 10:12 UTC

    For those of you yet to experience the pure joy of SSH used properly:

    On a unix box: (or Cygwin).

    %> ssh-keygen -b 1024 -t RSA <key in a good passphrase twice>

    Now let's copy the Public key to the remote machine you want to have access to:

    cat .ssh/id_rsa.pub | ssh -l<user> <target_ip> '[ -d .ssh ] || mkdir . +ssh ; chmod 700 .ssh ; cat - >> ~/.ssh/authorized_keys'

    Now let's start up ssh-agent. You can either run you WM via ssh-agent: Add the following to your .xinitrc file:

    exec /usr/bin/ssh-agent <Window Manager of choice>

    or to your .bashrc:

    SSHAGENT=$(which ssh-agent) SSHAGENTARGS="-s" if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then eval `$SSHAGENT $SSHAGENTARGS` trap "kill $SSH_AGENT_PID" 0 fi

    Hooray... We're all set

    Now, run ssh-add to add your private key passphrase to the ssh-agent keyring:
    %>ssh-add <key in your passphrase>

    Now, you can log into the remote machine with wanton abandon.


    Repeat as necessary

    I hope you'll all forgive the non-perlness of this post but I thought someone, somewhere may just find it usefull.

    SM

      For bonus points, tell us how to do it on Windows, since that was the OS in question.

      C.

        Castaway - Ooooh... A challenge... ;-)

        There is a problem with ssh-add on Win32 in that the ssh-agent thingummyjob only applies to the ssh-agent associated with it. i.e. you cannot (without a serious hack) run Program Manager (or whatever new-fangled name it's called nowadays) under ssh-agent...

        But:
        In my cygwin ~/.bashrc I have the function:
        newshell() { rxvt -g 90x80+560+0 -sr -sl 5000 -vb -e /bin/bash --login - & }

        So, I run ssh-add and then whenever I need a new shell I run the newshell func. (I have an X Client running in the windowless mode...)
        I'm sure if you were clever (I think I've used up my allowance for that this year...) you could create the relevant scripts to create those funky little icon things that some people seem to like so much.


        SM

        If you just want to copy specific files and don't care about storing the password in the script you can use the scp client from putty. pscp is pretty easy to use and you should be able to pass everything you need to retrieve a file in one command. I've set similar things up in batch files.