天天看點

iOS ssh無密碼登入

執行

ssh-keygen -t rsa

指令行生成公鑰、密鑰,需要互動輸入的直接Enter鍵

Nelson:~ Nelson$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/freegeek/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/freegeek/.ssh/id_rsa.
Your public key has been saved in /Users/freegeek/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:8apTQO4+0lrrLaAOj+rDNEvBn4RobR6NK4dLpz1B0ck [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|    o .          |
|   . E.          |
|o o +o  .        |
|.= B .o  o       |
|. O +. .S .      |
| B O. . ..       |
|* X..+...        |
| X.o..*+         |
|=o+ o+++.        |
+----[SHA256]-----+
複制代碼
           

此時

.ssh

目錄會多出

id_rsa

id_rsa.pub

兩個檔案.

将公鑰檔案複制到遠端裝置中

# ssh-copy-id [email protected]
複制代碼
           

此時再次通過

ssh

連接配接遠端裝置就不需要密碼

Nelson:~ Nelson$ ssh [email protected]
Nelson-iPad:~ root# 
複制代碼