Я сгенерировал ключи в системе Ubuntu 14.04, используя следующие команды для использования с ssh.
ssh-keygen -t rsa -b 2048
openssl rsa -in id_rsa -outform pem > pk_rsa.pem
openssl rsa -in pk_rsa.pem -pubout -out my_key.pem
Я скопировал my_key.pem в мой локальный каталог OSX. Попытка войти в Ubuntu с помощью команды ниже
ssh -v -i ./my_key.pem ubuntu@192.168.113.137
OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 192.168.113.137 [192.168.113.137] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file ./ubu14.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file ./ubu14.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to 192.168.113.137:22 as 'ubuntu'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:KDokJiZiQ9ZflT5Jm5B8krQ8XgsEEgUjQjg+h6C4Gqo
debug1: Host '192.168.113.137' is known and matches the ECDSA host key.
debug1: Found key in /Users/macdev/.ssh/known_hosts:11
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: ./my_key.pem
Enter passphrase for key './my_key.pem':
debug1: Next authentication method: password
mahesh@192.168.113.137's password:
Есть ли способ исправить эту проблему.
ssh
ssh-keygen
Махеш
источник
источник
ssh-copy-id username@<server-ip>
?