Featured image of post Alpine 配置 SSH 服务

Alpine 配置 SSH 服务

Alpine 配置 SSH 服务

1、Alpine安装SSH

1
apk add --no-cache openssh-server

2、查看SSH配置文件

1
cat /etc/ssh/sshd_config

3、修改sshd_config配置文件+重启sshd

1
2
3
4
5
6
7
8
sudo 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

service sshd restart && ip addr show eth0 | grep eth0

解释如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
-i.bak备份为sshd_config.bak
#PasswordAuthentication yes
#PermitRootLogin yes
SSH保持连接
#ClientAliveInterval 0
#ClientAliveCountMax 3
修改为:
PasswordAuthentication yes
PermitRootLogin yes
SSH保持连接
ClientAliveInterval 10
ClientAliveCountMax 999
本博客已稳定运行 小时 分钟
共发表 112 篇文章 · 总计 109.83 k 字
本站总访问量