centos设置允许访问的ip

参考:

https://www.lmlphp.com/user/64466/article/item/1159141/

https://blog.csdn.net/yangjiehuan/article/details/9253855

https://blog.csdn.net/qq_36746838/article/details/132298722

https://www.cnblogs.com/zhongguiyao/p/14082004.html

对服务器ssh登录限制:

vim /etc/ssh/sshd_config

在尾部加一行(允许所有ip登录)

AllowUsers root@*

或者(允许192.11.11.
AllowUsers root@192.11.11.

或者(允许192.11.
AllowUsers root@192.11.

/etc/init.d/sshd restart

如果已经开通ssh权限,ssh依然报错:

ssh: connect to host x.x.x.x port 22: Connection timed out

需要用telnet检查22端口是否通

如果22端口不通,需要检查原因*(比如vpn限制,防火墙限制,等等)

修改root用户ssh密码:

sudo passwd root

account locked due to failed logins...:

想办法用其他方法登录到该服务器上,执行如下命令:

pam_tally2 --user=root --reset

对服务器服务访问限制:

vim /etc/hosts.allow

最后一行添加(允许所有主机ssh登录)

sshd: ALL ##允许所有ip主机均能连接本机

service xinetd restart

相关推荐
桑榆41615 小时前
双系统(Windows + Ubuntu)安装流程
linux·windows·ubuntu
jerryinwuhan20 小时前
《系统部署与运维》开篇 课程介绍
运维
ltl1 天前
实时 OS 巡礼:VxWorks、QNX、Zephyr 与 PREEMPT_RT
linux
我是谁??1 天前
Ubuntu22.04更换清华源
linux·运维·服务器
Shell运维手记1 天前
Linux 常用基础命令学习笔记
linux·运维·笔记·学习·算法·github
朴马丁1 天前
国际与国产PLM在精细化工赛道的布局:2026年主要厂商技术特色
大数据·运维·人工智能·流程行业plm·化工新材料
Elastic 中国社区官方博客1 天前
Elasticsearch:使用 AI Agent 来创建 workflow
大数据·运维·人工智能·elasticsearch·搜索引擎·自动化·全文检索
测试运维日常笔记1 天前
Linux系统安装配置TigerVNC服务器完整指南
linux·运维·服务器
喜欢的名字被抢了1 天前
程序出问题怎么查,以及如何让它不掉线
java·运维·数据库
雾时之林1 天前
Linux----cron定时服务
linux·运维·服务器