安裝
OpenSSH是Secure Shell的一個開源實(shí)現(xiàn)瓣蛀。CentOS的軟件庫里面已經(jīng)有了OpenSSH的服務(wù)器包(openssh-server)和客戶端包(openssh-clients)雷厂,用yum install可以直接安裝。
yum install openssh-server
執(zhí)行 以下安裝命令 生成秘鑰文件 ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:bgGax5srcHPNIDykT9UIJN3b483PlvexJOkqB8Lp3LA root@dragon
The key's randomart image is:
+---[RSA 2048]----+
| .ooo o |
| .o + . |
| + ..o |
| . =+o.o |
| ooo+=S+ |
| . +..O+oo . |
| o o= B .o + o |
| . E o .* + o|
| .. oo.o o.|
+----[SHA256]-----+
所有需要輸入的地方 直接 enter
實(shí)現(xiàn)本地登錄免密碼登錄诈皿,地的公鑰導(dǎo)入授權(quán)文件就可以
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys 效果如下
[root@dragon 桌面]# cat /root/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAi+3ib/bPOoZlkO/lTu9YqL0BovcohjAax8S2oyiG0q0qFruMxwhL3xzoasbERB7/XtQW7sTR6tsfBjHkC6sjT2gqutWk5g1KSutBCw+4SKy4HfsHtQ7kVJ9cAT4D0fBxbeRw3VvguNUo6kRTNiEnbuEquze+rJerdLLlG3Lf9szr5E9qJWYsbPWhOjTP7JW7WttY37abgP9oZH5xx6pCxxZoY1ugNw+xgJaHL3tnmmQAy5Q7J4+AtGBKjb4OZTu0DO75w7qwQW+McNu4FD7obUrncZlNenfwt+CTSeiY5kUbeeStTzSqrqnrk5ZR4B94+FXZFeQP0z34oyqxSuJf root@dragon
這個就可以正常啟動了 不需要輸入密碼了