i have two hosts
H1 with ip=10.10.10.15
, OS=Windows Server 2016
and username=administrator
H2 with ip=10.10.10.16
, OS=Centos7
and username=user
I attempt to create a ssh connection between H1 and H2.
I mean, when i tape from the windows machine : ssh user@10.10.1.16
, i don't need to tape the password of user
and directly i have a remote access
After generate the key with ssh-keygen
, i try with ssh-copy-id -i id_rsa.pub user@10.10.1.16
and i enter the password
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
user@10.10.10.16's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'user@10.10.10.16'"
and check to make sure that only the key(s) you wanted were added.
but the console request always the password of user
Is there some way to resolve that ?
EDIT :
this the output of ssh -v user@10.10.1.16
OpenSSH_7.4p1 Debian-10+deb9u6, OpenSSL 1.0.2r 26 Feb 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.10.1.16 [10.10.1.16] port 22.
debug1: Connection established.
debug1: identity file /home/administrator/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/administrator/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/administrator/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/administrator/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/administrator/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/administrator/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/administrator/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/administrator/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 10.10.10.16:22 as 'user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
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:gIsbKkZPUqXJXkIwkjm0rNe+BS98+J0fQ+acbNgEzzI
debug1: Host '10.10.10.16' is known and matches the ECDSA host key.
debug1: Found key in /home/administrator/.ssh/known_hosts:25
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_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/administrator/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/administrator/.ssh/id_dsa
debug1: Trying private key: /home/administrator/.ssh/id_ecdsa
debug1: Trying private key: /home/administrator/.ssh/id_ed25519
debug1: Next authentication method: password
the output of sshd log
May 14 14:08:12 dockerjava sshd[17170]: Authentication refused: bad ownership or modes for file /home/user/.ssh/authorized_keys
the file is
-rw-rw-r--. 1 user user 1999 May 14 14:03 authorized_keys
-rw-------. 1 user user 1675 May 14 12:37 id_rsa
-rw-r--r--. 1 user user 398 May 14 12:37 id_rsa.pub
-rw-r--r--. 1 user user 1314 May 14 14:02 known_hosts