I tried everything mentioned in this solution Why am I still getting a password prompt with ssh with public key authentication?, but still getting prompt for password.
My local log:
ssh -vvv srvFlink@remoteHost
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/srvFlink/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/srvFlink/.ssh/id_dsa
debug3: no such identity: /home/srvFlink/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/srvFlink/.ssh/id_ecdsa
debug3: no such identity: /home/srvFlink/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/srvFlink/.ssh/id_ed25519
debug3: no such identity: /home/srvFlink/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
srvFlink@remoteHost's password:
Remote machine file permission:
drwx------. 2 srvFlink srvFlink 58 Aug 18 04:46 .ssh
-rw-------. 1 srvFlink srvFlink 1679 Aug 18 04:41 id_rsa
-rw-r--r--. 1 srvFlink srvFlink 406 Aug 18 04:41 id_rsa.pub
-rw-rw-r--. 1 srvFlink srvFlink 406 Aug 18 04:45 authorized_keys
drwx------. 2 srvFlink srvFlink 58 Aug 18 04:46 .
drwx------. 4 srvFlink srvFlink 4096 Aug 18 05:14 ..
In
/etc/selinux/config
file I have.
SELINUX=permissive
SELINUXTYPE=targeted
Content of id_rsa.pub of my local machine is there in the Remote machine ~/.ssh/authorized_keys
Content of
/etc/ssh/sshd_config
is same in both of the machine.
What might be the issue?
EDIT
Looks like file permission issue:
$ journalctl _COMM=sshd
Aug 18 06:54:53 localhost sshd[8891]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key
Aug 18 06:54:53 localhost sshd[8891]: Authentication refused: bad ownership or modes for file /home/srvFlink/.ssh/authorized_keys
Aug 18 06:54:56 localhost sshd[8891]: Connection closed by remotehost [preauth]
/var/log/authlog
on remote side to find out why the server rejected your key. Or post this log there. – user1700494 Aug 18 '16 at 10:40