How to setup SSH key to a server


This article shows how to setup SSH key to a server.

👽 Create SSH key

ssh-keygen -t rsa -C xxx@gmail.com

🚜 Copy SSH public key to server

# install ssh-copy-id
brew install ssh-copy-id

ssh-copy-id -i /path/to/ssh-key hoge_user@hogehoge.hoge.com

🎉 Disable password login

sudo vi /etc/ssh/sshd_config and edit the file:
(Set no to the following lines)

PasswordAuthentication no
ChallengeResponseAuthentication no

🐠 Restart SSH service

sudo systemctl restart sshd

🎳 Special Thanks

🖥 Recommended VPS Service

VULTR provides high performance cloud compute environment for you. Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour). In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!