165 字
1 分钟
新建普通用户
2026-06-24
SSH配置
新建普通用户并赋予sudo权限
新建普通用户
useradd -m -s /usr/bin/bash woioeow修改密码
passwd woioeow给普通用户赋予sudo权限
sudo apt update && sudo apt install vim sudo -y给/etc/sudoers文件加上以下参数
woioeow ALL=(ALL:ALL) ALL:x!保存退出
设置公钥认证
在本地电脑上的用户目录新建.ssh目录,再执行以下命令
ssh-keygen -t ed25519 -C "ssh_key"回车三次
把id_ed25519.pub上传到服务器的~/.ssh/,重命名为authorized_keys
设置文件权限
chmod 600 ~/.ssh/authorized_keys修改ssh配置文件
sudo vim /etc/ssh/sshd_config修改以下参数
Port 48256PermitRootLogin noPasswordAuthentication noPubkeyAuthentication yesAddressFamily inetKbdInteractiveAuthentication no重启ssh
sudo systemctl restart ssh