linux ssh密钥登录

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux ssh密钥登录相关的知识,希望对你有一定的参考价值。

ssh 端口:tcp 22

 

建议创建普遍用户登录管理

创建用户

useradd user

设置密码

passwd user


创建密钥

ssh-keygen -t rsa -P ‘‘


创建公钥

cat ~/.ssh/id_rsa.pub >~/.ssh/authorized_keys

chmod 600 ~/.ssh/authorized_keys


私钥

id_rsa 


ssh配置文件

vi /etc/ssh/sshd_conf

--------------------------------

PermitRootLogin no                // 改为no 禁止root用户登录

RSAAuthentication yes

PubkeyAuthentication yes

AuthorizedKeysFile      .ssh/authorized_keys

PasswordAuthentication no         // 改为 no 禁止口令登录

--------------------------------

去掉#
service sshd restart


本地服务器上将authorized_keys复制到远程服务器上

scp ~/.ssh/authorized_keys 10.10.10.10:/home/user/.ssh/



本文出自 “Shell” 博客,请务必保留此出处http://zhizhimao.blog.51cto.com/3379994/1946301

以上是关于linux ssh密钥登录的主要内容,如果未能解决你的问题,请参考以下文章

linux 只针对ROOT采用密钥登录

Linux SSH 密钥创建及密钥登录

linux ssh密钥登录

SSH详解-3.密钥登陆

Linux为 SSH 服务器配置密钥认证登录

如何配置ssh使用密钥登录,禁止口令登录