少女祈祷中...
NEKO
知识库

rockylinux 配置密钥登录

禁用密码登录

  • /etc/ssh/sshd_config

# 禁止 root 用密码远程登录,但允许密钥
PermitRootLogin prohibit-password

# 或更严格:完全禁止 root 远程登录
# PermitRootLogin no

PasswordAuthentication no
PubkeyAuthentication yes

添加公钥

vim ~/.ssh/authorized_keys

刷新 sshd

  • 检查配置

sshd -t

  • 刷新配置

systemctl reload sshd

评论