does chroot() require root privileges?
c, chroot, linux, root
Solution
`chroot` can only be used by `root` him/her/itself. And no, there won't be any other way without compromising security.
From Wikipedia
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.
See here for the article.
Problem
When I try to use chroot with "." or the complete pathname as argument, perror tells me "Operation not permitted". If the answer to my question is yes, is there another way to change root directory ? (Without barbarian methods using strcmp() / strncmp())