配置Linux伺服器SSH遠程密鑰登入

來源:互聯網
上載者:User

說明:

伺服器IP:192.168.1.200

管理員帳號:root 密碼:chenyi

普通登入帳號: itchenyi.com 密碼:chenyi

實現目的:

1、配置普通帳號通過密鑰驗證遠程SSH登入伺服器

2、禁用root帳號通過遠程SSH登入伺服器

3、禁用所有帳號通過密碼驗證遠程SSH登入伺服器

具體操作:

1、配置普通帳號通過密鑰驗證遠程SSH登入伺服器

使用普通帳號itchenyi.com登入伺服器操作

ssh-keygen -t rsa #產生密鑰

[itchenyi.com@chenyi ~]$ ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/home/itchenyi.com/.ssh/id_rsa): Created directory '/home/itchenyi.com/.ssh'.Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/itchenyi.com/.ssh/id_rsa.Your public key has been saved in /home/itchenyi.com/.ssh/id_rsa.pub.The key fingerprint is:b6:4c:c3:3c:24:c1:57:d6:11:b5:8f:f7:37:75:f5:69 itchenyi.com@chenyiThe key's randomart image is:+--[ RSA 2048]----+|     ..  .o.o+.  ||      ....  .  . ||      ...     . .||       =       o+||        S     .E*||       + +    ..+||        o      .o||                o||                 |+-----------------+

[itchenyi.com@chenyi ~]$ cd /home/itchenyi.com/.ssh/ #進入目錄

[itchenyi.com@chenyi ~]$ mv id_rsa.pub authorized_keys #產生驗證檔案

下載伺服器/root/.ssh/id_rsa檔案到本地(這裡採用flashfxp工具下載)

開啟puttygen.exe

下載地址:http://www.itchenyi.com/2911.html

選擇Conversions-Import key開啟上一步下載到本地的檔案id_rsa

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.