CentOS 配置SSH 服务
1、更新软件包+安装 openssh-server
1
|
yum -y update && yum install -y openssl openssh-server
|
2、查看SSH配置文件
1
|
cat /etc/ssh/sshd_config
|
3、修改置配文件+重新启动 SSH 服务,使更改生效
1
2
3
4
5
6
7
8
|
sed -i.bak \
-e '/Port 22/ a Port 22' \
-e '/PermitRootLogin/ a PermitRootLogin yes' \
-e '/ClientAliveInterval/ a ClientAliveInterval 10' \
-e '/ClientAliveCountMax/ a ClientAliveCountMax 999' \
/etc/ssh/sshd_config
systemctl restart sshd && hostname -I
|
1
2
3
4
5
6
7
8
9
10
11
12
|
-i.bak备份为sshd_config.bak
#Port 22
#PermitRootLogin prohibit-password
SSH保持连接
# ClientAliveInterval 0
# ClientAliveCountMax 3
修改为:
Port 22
PermitRootLogin yes
SSH保持连接
ClientAliveInterval 10
ClientAliveCountMax 999
|
本博客已稳定运行
天
小时
分钟
共发表 112 篇文章 · 总计 109.83 k 字
本站总访问量次