c - chroot() 需要 root 权限吗?

标签 c linux root chroot

当我尝试将 chroot 与“.”一起使用时或作为参数的完整路径名,perror 告诉我“不允许操作”。

如果我的问题的答案是肯定的,是否有另一种更改根目录的方法? (没有使用 strcmp()/strncmp() 的野蛮方法)

最佳答案

chroot 只能由 root 他/她/自己使用。不,在不损害安全性的情况下不会有任何其他方式。

来自维基百科

Only the root user can perform a chroot. This is intended to prevent users from putting a setuid program inside a specially crafted chroot jail (for example, with a fake /etc/passwd and /etc/shadow file) that would fool it into a privilege escalation.

参见 here对于文章。

关于c - chroot() 需要 root 权限吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15985290/

相关文章:

c - 整数值和计算

c - 转换为 void* 和基本结构指针之间是否存在性能差异?

c++ - getenv - 如何设置环境变量

macos - 如何让 strace 以非 root 权限运行跟踪命令?

.net - 从代码隐藏(.net)获取网站项目的根文件夹

c - 变量声明很昂贵吗?

c - 将数据结构写入文件

python - 使用脚本参数 ("env: No match."的 pycharm 远程调试问题)

c++ - 在 C/C++ 中检测密码保护的 MS Office 文件

android - 使用 root 访问权限在 Android 上打开另一个应用程序的 sqlite 数据库