On Wednesday 01 May 2002 11:47 pm, David Z Maze wrote:

> Run ssh-keygen(1) to generate a public/private keypair.  These should
> wind up in $HOME/.ssh, as identity and identity.pub.  Use scp to copy
> the identity.pub file to the target machine, and cat it on to the end
> of $HOME/.ssh/authorized_keys.  (It's possible that you might not have
> a .ssh directory; if not, create it, and run 'chmod 0700 .ssh'.)
>
> Now, when you log in, make sure you're running an ssh-agent(1)
> process.  (This happens by default when you log in to X, I believe.)
> Run ssh-add(1); this will prompt you for the pass-phrase for the ssh
> key, and register it with the agent.  Now when you run ssh, it will
> get the private key from the agent and use that to authenticate you to
> the remote machine (with no password).

Thanks for the quick guide. I decided to apt-get remove anything that 
remotely resembled anything to do with ssh, and start again. I also manually 
removed /etc/ssh* and ~/.ssh* as they affected the behaviour of ssh. 

Then I did apt-get install ssh, and immediately I'm confused. The output was:

        [EMAIL PROTECTED]:~# apt-get install ssh
        Reading Package Lists... Done
        Building Dependency Tree... Done
        The following NEW packages will be installed:
          ssh 
          0 packages upgraded, 1 newly installed, 0 to remove and 0  not 
upgraded.
          Need to get 0B/600kB of archives. After unpacking 1352kB will be used.
          Preconfiguring packages ...
          Selecting previously deselected package ssh.
          (Reading database ... 69032 files and directories currently 
installed.)
          Unpacking ssh (from .../ssh_1%3a3.0.2p1-9_i386.deb) ...
          Setting up ssh (3.0.2p1-9) ...
          Creating SSH2 RSA key
          Creating SSH2 DSA key
          Restarting OpenBSD Secure Shell server: sshd.

That looks to me like it's installing ssh2, and not ssh. I'm not sure of what 
the differences are, but I'm not sure what I've got installed; ssh, or ssh2, 
or both, and whether that is important.

Curiously, the output of installing it on the laptop is slightly different. 
It appears to have set a SSH1 key. (NB: The laptop is 'vaiow', the server is 
'guestw'). The output from installing on the laptop is:


        [EMAIL PROTECTED]:~# apt-get install ssh
        Reading Package Lists... Done
        Building Dependency Tree... Done
        The following NEW packages will be installed:
          ssh 
        0 packages upgraded, 1 newly installed, 0 to remove and 0  not upgraded.
        Need to         get 0B/600kB of archives. After unpacking 1352kB will 
be used.
        Preconfiguring packages ...
        Selecting previously deselected package ssh.
        (Reading database ... 61637 files and directories currently installed.)
        Unpacking ssh (from .../ssh_1%3a3.0.2p1-9_i386.deb) ...
        Setting up ssh (3.0.2p1-9) ...
        Creating SSH1 key
        Creating SSH2 RSA key
        Creating        SSH2 DSA key
        Restarting OpenBSD Secure Shell server: sshd

Notice the extra line: 'Creating SSH1 key'

I then use ssh-keygen to create my public/private pairs, and scp the public 
to guestw. I cat it to the end of authorized keys. guestw looks like this:

        [EMAIL PROTECTED]:~$ ls -ld .ssh
        drwx--S---    2 dougie   dougie       4096 May  2 09:01 .ssh
        [EMAIL PROTECTED]:~$ ls -l .ssh
        total 16
        -rwx------    1 dougie   dougie        995 May  2 09:01 authorized_keys
        -rw-------    1 dougie   dougie        528 May  2 08:34 identity
        -rw-r--r--    1 dougie   dougie        332 May  2 08:34 identity.pub
        -rw-r--r--    1 dougie   dougie        455 May  2 09:01 known_hosts

        [EMAIL PROTECTED]:~$ ps -ef | grep agent
        dougie     361   332  0 08:52 ?        00:00:00 /usr/bin/ssh-agent
                                                        x-session-manager


I had a bit of a problem initially with ssh-agent, as it has to be run on the 
machine itself. So I have to run around the house to go to each PC and type 
it in, rather than from a telnet session. i.e. The telnet session produces:
        
        [EMAIL PROTECTED]:~$ ssh-add
        Could not open a connection to your authentication agent.

Finally ran ssh-add successfully and did a few tests. Here's the end of the 
output from ssh -v guestw (run from vaiow):

        debug1: Connection established.
        debug1: identity file /home/dougie/.ssh/identity type 0
        debug1: identity file /home/dougie/.ssh/id_rsa type -1
        debug1: identity file /home/dougie/.ssh/id_dsa type -1
        debug1: Remote protocol version 2.0, remote software version 
OpenSSH_3.0.2p1 
        Debian 1:3.0.2p1-9
        debug1: match: OpenSSH_3.0.2p1 Debian 1:3.0.2p1-9 pat ^OpenSSH
        Enabling compatibility mode for protocol 2.0

        debug1: Local version string SSH-2.0-OpenSSH_3.0.2p1 Debian 1:3.0.2p1-9
        debug1: SSH2_MSG_KEXINIT sent
        debug1: SSH2_MSG_KEXINIT received
        debug1: kex: server->client aes128-cbc hmac-md5 none
        debug1: kex: client->server aes128-cbc hmac-md5 none
        debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
        debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
        debug1: dh_gen_key: priv key bits set: 131/256
        debug1: bits set: 510/1024
        debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
        debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
        debug1: Host 'guestw' is known and matches the RSA host key.
        debug1: Found key in /home/dougie/.ssh/known_hosts:1
        debug1: bits set: 512/1024
        debug1: ssh_rsa_verify: signature correct
        debug1: kex_derive_keys
        debug1: newkeys: mode 1
        debug1: SSH2_MSG_NEWKEYS sent
        debug1:         waiting for SSH2_MSG_NEWKEYS
        debug1: newkeys: mode 0
        debug1: SSH2_MSG_NEWKEYS received       
        debug1: done: ssh_kex2.
        debug1: send SSH2_MSG_SERVICE_REQUEST
        debug1: service_accept: ssh-userauth
        debug1: got SSH2_MSG_SERVICE_ACCEPT
        debug1: authentications that can continue: 
publickey,password,keyboard-interactive
        debug1: next auth method to try is publickey
        debug1: try privkey: /home/dougie/.ssh/id_rsa           
        debug1: try privkey: /home/dougie/.ssh/id_dsa
        debug1: next auth method to try is keyboard-interactive
        
        Password: 


So close, but no cigar! My reading of the output is that it's using SSH2, and 
it won't find the keys: /home/dougie/.ssh/id_rsa. These look like SSH2 files. 
But I have just done apt-get install ssh, so I'm not sure what I've got 
installed, or what the difference is.

Dougie


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to