Linux 限制root用户远程登录-ssh

news/2024/7/24 12:12:19

参考步骤:
(1).执行备份:
#cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_bak
(2).新建一个普通用户并设置高强度密码(防止设备上只存在root用户可用时,无法远程访问):
#useradd username
#passwd username
(3).禁止root用户远程登录系统
3.1.编辑文件/etc/ssh/sshd_config(vi /etc/ssh/sshd_config),修改PermitRootLogin值为no并去掉注释.
PermitRootLogin no                      #则禁止了root从ssh登录。
3.2.重启ssh服务
#/etc/init.d/sshd restart
(4).修改ssh协议版本
4.1.编辑文件/etc/ssh/sshd_config(vi /etc/ssh/sshd_config),修改Protocol的值为2并去掉注释.
Protocol 2
4.2.重启ssh服务
#/etc/init.d/sshd restart

 

最后欢迎大家访问我的个人网站:1024s


http://www.niftyadmin.cn/n/1276402.html

相关文章

nmap端口状态解析

nmap端口状态解析 状态 说明 open 应用程序在该端口接收 TCP 连接或者 UDP 报文 closed 关闭的端口对于nmap也是可访问的, 它接收nmap探测报文并作出响应。但没有应用程序在其上监听 filtered 由于包过滤阻止探测报文到达端口,nmap无法确定该端口…

js社区最大的误解

介绍 (Introduction) If you are trying to get a good understanding of what’s composition vs inheritance, you probably search on google etc., read articles and watch videos around “composition vs inheritance”. Here’s the problem, you are going to learn i…

安装Docker,配置阿里云加速和 docker-compose 国内镜像

Centos 7 安装 Docker 官网 https://docs.docker.com/install/ 找到 linux --Centos,操作步骤如下 Install Docker Engine on CentOS 直接按照他的操作步骤进行即可 抄录一下 Set up the repository sudo yum install -y yum-utilssudo yum-config-manager –a…

Python 日期和时间(转)

Python 日期和时间 Python程序能用很多方式处理日期和时间。转换日期格式是一个常见的例行琐事。Python有一个 time 和 calendar 模组可以帮忙。 什么是Tick? 时间间隔是以秒为单位的浮点小数。 每个时间戳都以自从1970年1月1日午夜(历元)经过…

Linux 关闭Telnet服务

1)备份 #cp -p /etc/xinetd.d/telnet /etc/xinetd.d/telnet_bak 2)编辑文件/etc/xinetd.d/telnet(vi /etc/xinetd.d/telnet),把disable项改为yes,即disable yes. 3)执行以下命令重启xinetd服务 #service xinetd restart 最后欢迎大家访问我的个人网站:1024s

使用React测试库进行交互测试

我的旅途 (My Journey) Testing is complicated. I’ve certainly never been good at it. For the longest time, I’ve only been focused on basic function input output unit tests. Why? Because they were easy — you didn’t need to render HTML, you didn’t need …

微服务网关实战——Spring Cloud Gateway

导读 作为Netflix Zuul的替代者,Spring Cloud Gateway是一款非常实用的微服务网关,在Spring Cloud微服务架构体系中发挥非常大的作用。本文对Spring Cloud Gateway常见使用场景进行了梳理,希望对微服务开发人员提供一些帮助。 微服务网关Sp…

ckeditor自定义上传_带有自定义图像上传器的ckeditor5React

ckeditor自定义上传Spent almost 2 days figuring out a proper way to use CKEditor5 image uploader. I’ve tried ckFinder, SimpleUploader, etc. but none of them worked maybe because none of the documentations made any sense to me 😂. Luckily I found…