Hi Community,
Thanks for all the information being shared here.
I was provided with a Public key by vendor to set up my IBMi environment to use their SFTP.
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhktestingiG9w0BAQEFAAOCAQ8AMIIQWER8TESTin327R92YRO
QADFJGDALF9YRBCgKCAQQTREW2EAwRoYbhi2rc0drmhkfyPXthere is more
data but i edited them out4QIDAQAB
-----END PUBLIC KEY-----
I added the key to Authorized_Key but unable to connect. I verified, if I have the vendor set up IBMi public key (id_rsa.pub) at their end the connection works fine.
Am i missing something. Any suggestion or help is highly appreciated.
cat /tmp/vendorkey.pub >> /home/user-id/.ssh/authorized_keys
chmod 600 /home/user-id/.ssh/authorized_keys
sftp -vvv SFTPID@SFTP.COM
debug1: Connection established.
debug1: identity file /home/RDSFILES/.ssh/id_rsa type 0
debug1: identity file /home/RDSFILES/.ssh/id_rsa-cert type -1
debug1: identity file /home/RDSFILES/.ssh/id_dsa type -1
debug1: identity file /home/RDSFILES/.ssh/id_dsa-cert type -1
debug1: identity file /home/RDSFILES/.ssh/id_ecdsa type -1
debug1: identity file /home/RDSFILES/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/RDSFILES/.ssh/id_ed25519 type -1
debug1: identity file /home/RDSFILES/.ssh/id_ed25519-cert type -1
debug1: identity file /home/RDSFILES/.ssh/id_xmss type -1
debug1: identity file /home/RDSFILES/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.0
kex_exchange_identification: Connection closed by remote host
Or If I try with IdentityFile
sftp -vvv -o IdentityFile=~/.ssh/vendorkey.pub SFTPID@SFTP.COM
debug1: Local version string SSH-2.0-OpenSSH_8.0
kex_exchange_identification: Connection closed by remote host
sftp -vvv -o IdentityFile=~/.ssh/authorised_keys SFTPID@SFTP.COM
debug1: Local version string SSH-2.0-OpenSSH_8.0
kex_exchange_identification: Connection closed by remote host
SSH connection using External Public Key
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: SSH connection using External Public Key
It looks like the key is not in the correct format for the OpenSSH authorized_keys file. In authorized_keys, each key is only 1 line long (the line may be wrapped because its too large for the screen, but it is only one row in the file.) It should begin with ssh-rsa and end with the account identity.
Yours isn't like that, it looks like it may be PEM format or similar.
Learn more here https://stackoverflow.com/questions/127 ... key-format
Yours isn't like that, it looks like it may be PEM format or similar.
Learn more here https://stackoverflow.com/questions/127 ... key-format