Use server key to login Linux

if you want to login your server without password, you can try to create server key to login.
Please follow next steps:

$ cd ~ && mkdir .ssh
$ cd .ssh
$ ssh-keygen -t rsa // keep enter without anything

 

ff8378ecdce2459abf4114599feddf99_view.png

$ mv id_rsa.pub authorized_keys
$ vim /etc/ssh/sshd_config

change
PasswordAuthentication yes to PasswordAuthentication no

PubkeyAuthentication yes //delete #
AuthorizedKeysFile .ssh/authorized_keys //delete #

save and exit
download “id_rsa” and use it to login: ssh -i /path/id_rsa [email protected]_address

$ service sshd  restart

 

then you can use that private key to login your server