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 [email protected].

或者(允许192.11.
AllowUsers [email protected].

/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

相关推荐
国际云,接待8 分钟前
腾讯云国际版服务器从注册到使用的完整流程指南
运维·服务器·阿里云·架构·云计算·腾讯云·csdn开发云
Lzc77419 分钟前
Linux的权限
linux·linux的权限
泛黄的咖啡店1 小时前
域名系统DNS
运维·云计算
dessler1 小时前
Kubernetes(k8s)-集群监控(Prometheus)
linux·运维·kubernetes
一夜沐白1 小时前
Linux用户管理
linux·运维·服务器·笔记
PLUS_WAVE2 小时前
【Tools】chezmoi 跨多台不同的机器管理 dotfiles 的工具
linux·服务器·软件工程·工具·chezmoi
Pasregret3 小时前
备忘录模式:实现对象状态撤销与恢复的设计模式
运维·服务器·设计模式
唐青枫3 小时前
Linux man 命令使用教程
linux
珹洺3 小时前
Linux红帽:RHCSA认证知识讲解(十 四)分区管理、交换分区,创建逻辑卷与调整逻辑卷的大小
linux·运维·服务器
威桑3 小时前
解决Ubuntu下使用CLion构建Qt项目时找不到已安装的模块的问题
linux·运维·ubuntu