ssh服务 及禁止root用户远程登录

ssh服务搭建

关闭防火墙与selinuxsystem

systemctl status firewalld.service (查看防火墙状态)

systemctl stop firewalld.service (临时关闭)

systemctl disable firewalld(关闭开机自启)

getenforce (查看selinux状态)

setenforce 0 (临时关闭selinux)

vim /etc/selinux/config (编辑selinux配置文件)

SELINUX=disable (修改选项,永久关闭)

或者sed -i “s/SELINUX=enforcing/SELINUX=disabled/” /etc/selinux/config;(永久关闭)

配置yum源并安装

一般现在都自带ssh,安装个毛,省略
systemctl restart sshd
查看状态
systemctl status sshd
进程查看方式
ps aux |grep sshd
端口查看方式
netstat -lntp|grep sshd
开启自启动
systemctl enable sshd

禁止远程root用户登录

修改配置文件 vim /etc/ssh/sshd_config
打开文件第38行 修改以下内容
#PermitRootLogin yes
PermitRootLogin no

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值