[Linux] SSH PEM 免密碼登入指南 (Public Key Authentication)

Intro

X.509標準下我們可以製作PEM私鑰,用以登入放置公鑰的伺服器。


製作流程

1. 當前帳號執行Key產生器

ssh-keygen

產生於~/.ssh下:

id_rsa.pub // 公開金鑰(public key)
id_rsa // 私密金鑰(private key)

2. Public Key放至登入伺服器上帳號的~/.ssh/authorized_keys:

ssh user@remotehost 'mkdir -p ~/.ssh;cat >> ~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub

or

ssh-copy-id -i ~/.ssh/id_rsa.pub user@remotehost

Reference

X.509
PEM (Privacy-enhanced Electronic Mail)

Leave a Reply

Your email address will not be published. Required fields are marked *