Dropbear
Dropbear 是一个轻量级的 SSH 服务器,常用于路由器和其他低内存设备。它也经常被配置在启动过程中运行。
安装
配置
Dropbear 服务器没有配置文件。它通过命令行选项进行配置。
启用/启动 dropbear.service
。
禁用密码和 root 登录
编辑 dropbear.service
。这将创建一个新的drop-in 文件。向其添加内容将覆盖主配置中的相应部分。
覆盖启动 Dropbear 的命令
[Service] ExecStart= ExecStart=/usr/bin/dropbear -F -P /run/dropbear.pid -R -w -s
-R
- 用于自动生成主机密钥。
-F
- 用于禁止 fork 到后台。
-w
- 用于禁止 root 登录。
-s
- 用于禁用密码登录。
从 GitLab 设置 SSH 密钥
将 GitLab URL 更改为您自己的。
$ mkdir -p ~/.ssh -m 0700 $ curl -sSLf https://gitlab.com/example.keys >> ~/.ssh/authorized_keys
Docker 容器中的 Dropbear
systemctl
在 `archlinux` Docker 容器中不起作用。
# systemctl start dropbear
System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down
您需要手动启动 Dropbear。
# /usr/bin/dropbear -F -P /run/dropbear.pid -R -w -s