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



$ mv authorized_keys
$ vim /etc/ssh/sshd_config

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