首先新增使用者,我叫他ralink
root@anita:~# adduser ralink
然後以他身份自己創造ssh-key
ralink@anita:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ralink/.ssh/id_rsa):
Created directory '/home/ralink/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ralink/.ssh/id_rsa.
Your public key has been saved in /home/ralink/.ssh/id_rsa.pub.
The key fingerprint is:
15:f6:dc:45:6e:05:81:cf:6a:09:26:1c:f1:1d:88:ea ralink@anita
The key's randomart image is:
+--[ RSA 2048]----+
| .oo...o++|
| oo.=.o o.|
| o .o +o. o|
| . o.o o. |
| . So . o |
| E + |
| . |
| |
| |
+-----------------+
接下來,把Key餵給ralink自己吃
ralink@anita:~$ cd .ssh/; ls
id_rsa id_rsa.pub
ralink@anita:~/.ssh$ cp id_rsa.pub authorized_keys
把私鑰用轉換為pietty喜歡的格式
首先去http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html抓公用程式puttygen.exe,然後執行。
這時候,菜鳥們會問,怎麼弄回來?超簡單的,用Ctrl + C / Ctrl + V不就回來了?
ralink@anita:~/.ssh$ cat id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAujgQF8LHmJdCGwaezglZNPA9QeX3r2stpCvBXoZGAWN8C2jl
bxULfjc8meaSSi51laxvaWMWS7fvy+ugw/tItd161kkGiAURWoVWAdulR+Gt8PKP
……
打開剛剛的puttygen.exe
Load進去檔案
這暗示的很清楚了
按下Save private key
可以偷看一下內容
設定一個新的連線設定檔
Auth選項裡面指向剛剛產生的ppk
可以再懶一點,輸入自動登入名字
記得存檔
按下Open,立刻連線成功
沒有留言:
張貼留言