专栏总目录
一、安装sshd服务
sudo apt update
sudo apt install -y openssh-server
二、配置sshd
使用文本编辑器打开/etc/ssh/sshd_config
sudo vi /etc/ssh/sshd_config
(一)配置sshd服务的侦听端口
建议将ssh的侦听端口改为7000以上的端口,以避免默认端口带来的安全风险

(二)禁止使用root用户登录sshd服务

(三)增加一个AllowUsers参数,设置为一个普通用户
例如我这个机器的用户名为mrt,如下图设置:

配置完成保存退出
三、重启sshd服务
sudo systemctl restart ssh