Friday, December 6, 2019

linux - ssh public key authentication

I have tried to configure ssh to use public key authentication




The link



/etc/ssh/sshd_config has got this parameters.



RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

PasswordAuthentication yes



But I'm still being prompted for password. If I use



PasswordAuthentication no


I can't login



Any suggestion?







It works but only for root user.



My problem was, I had this parameter



PermitRootLogin no.



I can login with keys with root user if I use




PermitRootLogin yes.



In the system there is only a /root/.ssh directory an authorized_keys file in this directory



How can I add this to other users, if there isn't, in this system, a home/$USER/.ssh directory and authorized_keys file for each user?



Is there a way to configure for each user?
I will need diferent authorized_keys files for each user.




Is possible to configure for a different hosts, domains or ips? similar to httpd.conf

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...