fix: root 启动限制改为提醒

This commit is contained in:
shiyue
2026-06-24 10:04:33 +08:00
parent 2f02270edc
commit a794607817
2 changed files with 6 additions and 2 deletions

View File

@@ -140,7 +140,7 @@ cd cc-web
`start.sh` 会执行以下动作:
- 拒绝 root 用户运行
- root 用户运行时提醒风险
- 检查 Node.js >= 18 和 npm
-`.env.example` 创建 `.env`
- 首次部署时引导设置登录密码

View File

@@ -19,6 +19,10 @@ fail() {
exit 1
}
warn() {
printf '[cc-web pm2] WARNING: %s\n' "$*" >&2
}
ensure_command() {
local cmd="$1"
local hint="$2"
@@ -268,7 +272,7 @@ start_or_restart_app() {
main() {
if [[ "$(id -u)" -eq 0 ]]; then
fail "请使用 root 用户执行。该服务会启动 Claude/Codex 子进程root 运行风险过高。"
warn "当前正在使用 root 用户执行。该服务会启动 Claude/Codex 子进程root 运行风险较高,建议改用非 root 用户。"
fi
[[ -f "${ENTRY_PATH}" ]] || fail "找不到入口文件: ${ENTRY_PATH}"