ssh公钥登录

原因 通过密码进行ssh连接存在被暴力破解的可能,但在禁用密码登录+修改22端口+禁用root登录之后,可以将被暴力破解的概率降到最低,且通过private_key登录服务器更适合shell操作 生成公钥,私钥 下面以ubuntu18.04为例 #( 09/27/18@11:30上午 )( lestat@lestat-MS-7A15 ):~/Desktop ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/lestat/.ssh/id_rsa): /home/lestat/.ssh/vps Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/lestat/.ssh/vps. Your public key has been saved in /home/lestat/.ssh/vps.pub. The key fingerprint is: SHA256:rcD6QAPXaRrDfNMR1MdQu/s4TvEtOlumK3AUcdzrUaM lestat@lestat-MS-7A15 The key's randomart image is: +---[RSA 2048]----+ | .+oo*o. | | o . o .o.+....| | . * * . o. .o.| | o B . .. Eo | | + o S.. o. . | | . o .... +.. | | o .o o = .| | o ..oB . | | . oB=. | +----[SHA256]-----+ 建议在passphrase处设置密码,防止key被盗用!!! 以上提示说明生成成功 接下来加入到authorized_keys ...

September 27, 2018 · 1 min · 171 words