ssh禁止用户登录

1、selinx修改
vim /etc/selinux/config
将其改为SELINUX=disabled
getenforce 查看当前状态
如果不想重启系统,使用命令setenforce 0
2、为了防止ssh被暴力×××,对ssh默认端口进行更改。
vim /etc/ssh/sshd_conf
将#Port 22更改为你想要的端口,Port 5022
更改防火墙/etc/sysconfig/iptables
增加-A INPUT -m state --state NEW -m tcp -p tcp --dport 5022 -j ACCEPT
然后重启防火墙 service iptables restart
3、由于root权限过大,对于ssh用户登录存在安全隐患。禁止root用户登录
(1)先添加一个普通用户
useradd rxhpay -m
passwd rxhpay
(3)vim /etc/ssh/sshd_conf
将#PermitRootLogin yes 改成 PermitRootLogin no
(4)重启sshd服务
service sshd restart
4、Linux系统默认打开文件数是1024,修改/etc/security/limits.conf
ulimit -a

  • soft nofile 65536
  • hard nofile 65536

转载于:https://blog.51cto.com/980696/2144004

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值