I am trying to chroot a user when they login with ssh. So, what I did is added the following line to their .bashrc
file:
chroot /apps/web
When I login with the user though, I am getting:
chroot: cannot change root directory to /apps/web: Operation not permitted
The permissions on /apps/web is root user and group owned. Any ideas?
Best Answer
Only root has permission to
chroot
.This probably won't give you a usable login - do you have a complete copy of all executables, data and libraries the user would need under
/apps/web
? It won't work without it.If you do, then you can accomplish this by using
sudo
and allowing all users to execute, as root, a passwordlesschroot /apps/web
.