devcontainer-tweak/dev-ubuntu-20.04-ssh/entrypoint.sh

18 lines
320 B
Bash

#!/bin/bash
# 1. 重新生成 SSH 密钥对
rm -f /etc/ssh/ssh_host_*
ssh-keygen -A
# 2. 启动 SSH 服务
service ssh start
# 3. 默认命令检查
if [ "$#" -eq 0 ]; then
# 如果没有传入参数,则默认执行 tail -f /dev/null
exec tail -f /dev/null
else
# 执行传入的命令
exec "$@"
fi