LEEUNITYAssets / Content / 博客.asset
层级
⌄ Lee / Homepage
INSPECTOR
Type
Content
Name
博客
lee@mtftm.com ↗GitHub ↗
N020SYSTEM / LINUX

技术 / English

Use SSH Key to Log In to the Server and Disable Password Login

- Generate a key pair using the command ssh-keygen or use an existing key pair - Copy the corresponding publi…

更新
2026.07.18
阅读
1 分钟
语言
English

Configure SSH Key Login

  • Generate a key pair using the command ssh-keygen or use an existing key pair
  • Copy the corresponding public key to the root/.ssh/authorized_keys file.

Disable password login

Edit the /etc/ssh/sshd_config file and modify the following parameters:

PubkeyAuthentication yes
PasswordAuthentication no

Restart the SSH Service

sudo systemctl restart sshd

If it does not take effect, delete all files in etc/ssh/sshd_config.d.