Debian 的 context 这个词在不同场景下含义不同,先帮你确认一下,再给你对应的教程资源。
Debian 默认 不使用 SELinux,而是用 AppArmor。
但如果你在 Debian 上手动启用了 SELinux,就会涉及 security context。
Debian 官方 SELinux 文档
https://wiki.debian.org/SELinux
SELinux 入门(通用)
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/using_selinux/index
常用命令:
ls -Z # 查看文件 context
ps -Z # 查看进程 context
semanage fcontext -l
restorecon -Rv /path
常见的是:
setcontext / getcontext / makecontext / swapcontext这是 POSIX ucontext 系列函数(已废弃,但仍有人用)。
man 手册(最权威)
man getcontext
man makecontext
TLPI(Linux/Unix 系统编程)
https://man7.org/tlpi/
中文示例:
比如 debhelper、dpkg-buildpackage 的构建上下文。
Debian 新维护者手册(中文)
https://www.debian.org/doc/manuals/maint-guide/
Debian Policy
https://www.debian.org/doc/debian-policy/
docker context --help
可以告诉我你用 Debian 做什么(服务器 / 桌面 / 容器 / 编程 / 安全),我可以 直接给你最合适的教程和示例。