This commit is contained in:
2026-02-14 05:36:00 +08:00
commit d7cd899983
37 changed files with 4169 additions and 0 deletions

14
internal/auth/auth.go Normal file
View File

@@ -0,0 +1,14 @@
package auth
import (
"fmt"
"os"
)
// RequireRoot 检查是否以 root 身份运行
func RequireRoot() error {
if os.Geteuid() != 0 {
return fmt.Errorf("此操作需要 root 权限,请使用 sudo 或切换到 root 用户")
}
return nil
}