OpenSSH to SSH2 key transfers



This issue occurs when you ssh from an OpenSSH machine to a SSH2 machine. For this example assume the machine names are openmach and ssh2mach respectively. Normally the procedure to allow yourself to ssh to another machine is appending a copy of your public key (ex: id_dsa.pub) to ~/.ssh/authorized_keys2 file on the remote machine. In this instance however the public key is stored differently on the SSH2 machine.

Below is the procedure for this process:
  1. Convert your current dsa key on openmach to the public key format the SSH2 machine ssh2mach requires.
    username@openmach: ~/.ssh 140% ssh-keygen -x -f id_dsa
    where id_dsa is the name for your key combo
  2. Place the output of this command into a file in ~/.ssh2/ on ssh2mach
  3. Place the word Key, a space and the name of this file into ~/.ssh2/authorization on ssh2mach

username@openmach: ~/.ssh 138% ls
authorized_keys*  config2  id_dsa.pub  identity.pub*  known_hosts
config            id_dsa   identity*   identityold*   known_hosts2
username@openmach: ~/.ssh 139% cat id_dsa.pub         
ssh-dss AAAAB3NzaC1kc3MAAACBAJny2RAgHP2fYBw0Acq/FARAsSHmJPacHQ72Ya
KEHeXDFglWfTm/leXMa7BF2+OxPnStQRxwQjl/ZBaiuQ9Y6oC1dTsA52swYKlFgYYk
LZddtAQt0iTRNYFtHXjxZQqCKJtxZyLA5w/0wDXlfvVaqM/RwglXl/Am0Cuaj98xem
SFAAAAFQDjaLQINVG8d01X4bp2ikbOR65n2QAAAIBLcU0Ehlq6PHL5GasYWuN+5rU0
yOtzRoI9z1X/SWgP6o1eQtT07VErG2PJzLMvbVf56wAqGL81LKCJ0AsoaXoDgUIiV8
VM/74VBuC2J/WxNlwuK9MBS0Dzv3KpsvU+lth9Wm2ABRaoSClJS6O6hmKm0/tEQ9bS
4edHBgA6RUFQwQAAAIBpPwoT3JThOvzBGB4VZrvhzRb/MEvvqFvC9QZcgQBbWDYuEz
G8KtvnjgBwZWFAAdTgaLCUeLZIkdApW4dGKYD0hQooC95JYxWq8YIv7JDnyWq43lzy
iXaoYYdfbPSjNMNanokjEovHS5jIxl/GlCF+e+ZgTKXDFgm5kKSSmeydNQ==
username@openmach

username@openmach: ~/.ssh 140% ssh-keygen -x -f id_dsa
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "1024-bit DSA, converted from OpenSSH by username@openmach"
AAAAB3NzaC1kc3MAAACBAJny2RAgHP2fYBw0Acq/FARAsSHmJPacHQ72YaKEHeXDFglWfT
m/leXMa7BF2+OxPnStQRxwQjl/ZBaiuQ9Y6oC1dTsA52swYKlFgYYkLZddtAQt0iTRNYFt
HXjxZQqCKJtxZyLA5w/0wDXlfvVaqM/RwglXl/Am0Cuaj98xemSFAAAAFQDjaLQINVG8d0
1X4bp2ikbOR65n2QAAAIBLcU0Ehlq6PHL5GasYWuN+5rU0yOtzRoI9z1X/SWgP6o1eQtT0
7VErG2PJzLMvbVf56wAqGL81LKCJ0AsoaXoDgUIiV8VM/74VBuC2J/WxNlwuK9MBS0Dzv3
KpsvU+lth9Wm2ABRaoSClJS6O6hmKm0/tEQ9bS4edHBgA6RUFQwQAAAIBpPwoT3JThOvzB
GB4VZrvhzRb/MEvvqFvC9QZcgQBbWDYuEzG8KtvnjgBwZWFAAdTgaLCUeLZIkdApW4dGKY
D0hQooC95JYxWq8YIv7JDnyWq43lzyiXaoYYdfbPSjNMNanokjEovHS5jIxl/GlCF+e+Zg
TKXDFgm5kKSSmeydNQ==
---- END SSH2 PUBLIC KEY ----

username@ssh2mach: ~/.ssh2 6% ls                  
authorization   username-openmach.pub
username@ssh2mach: ~/.ssh2 7% cat authorization   
Key username-openmach.pub
username@ssh2mach: ~/.ssh2 8% cat username-openmach.pub 
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "1024-bit DSA, converted from OpenSSH by username@openmach"
AAAAB3NzaC1kc3MAAACBAJny2RAgHP2fYBw0Acq/FARAsSHmJPacHQ72YaKEHeXDFglWfT
m/leXMa7BF2+OxPnStQRxwQjl/ZBaiuQ9Y6oC1dTsA52swYKlFgYYkLZddtAQt0iTRNYFt
HXjxZQqCKJtxZyLA5w/0wDXlfvVaqM/RwglXl/Am0Cuaj98xemSFAAAAFQDjaLQINVG8d0
1X4bp2ikbOR65n2QAAAIBLcU0Ehlq6PHL5GasYWuN+5rU0yOtzRoI9z1X/SWgP6o1eQtT0
7VErG2PJzLMvbVf56wAqGL81LKCJ0AsoaXoDgUIiV8VM/74VBuC2J/WxNlwuK9MBS0Dzv3
KpsvU+lth9Wm2ABRaoSClJS6O6hmKm0/tEQ9bS4edHBgA6RUFQwQAAAIBpPwoT3JThOvzB
GB4VZrvhzRb/MEvvqFvC9QZcgQBbWDYuEzG8KtvnjgBwZWFAAdTgaLCUeLZIkdApW4dGKY
D0hQooC95JYxWq8YIv7JDnyWq43lzyiXaoYYdfbPSjNMNanokjEovHS5jIxl/GlCF+e+Zg
TKXDFgm5kKSSmeydNQ==
---- END SSH2 PUBLIC KEY ----





The opposite is to go from a Secure Shell box to an openssh box.
  1. on Secure Shell box: copy your identity.pub (public key) to the openssh box.
  2. ssh-keygen -X -f Secure_Shell_public_key.pub >> .ssh/authorized_keys2

Last modified: Wed Jan 23 14:09:59 EST 2002