Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
you probably need to set the sticky bit. Find where chroot is (probably in /bin), go to the directory and then do
chmod +s chroot
After this, you should be able to execute chroot as a normal user.you can check with
chroot /
If this does not return an Operation not permitted message, you can use chroot as a normal user.
But if you don't have the needed binaries and libraries in the new root, you'll get error messages.
ok, done that. now chroot says can't find /bin/bash
so I copied /bin/bash to ~/bin/bash and I got a permission denied, so I fixed the permissions to RWXR-XR-X on both the dir and file and it sayes can find /bin/bash again?
when you set the sticky bit, the program is run with the privileges of the owner of the program. So since chroot is owned by root, when you set the sticky bit for it, a user can run it with the privileges of root (could be a security issue for some programs; not sure about chroot - you might want to check - though since you immediately move into the chroot environment and if you set it up to logout immediately after you are done, it should be all right).
The reason it says that it can't find /bin/bash is probably because you need a whole lot of other things to be able to read from the disk. Everything that is needed has to be in your new chroot environment. If you have diskspace to spare, you could start out with copying /bin, /lib, /usr/bin, /usr/lib, /etc over to your home directory. Then you could start whittling it down.
I think if you do that, nothing will run as normal user as it denies read access to all files. If this is not true, I think users will still have access to the files so long as they know the locations.
If you're worried about users writing or changing files they should not, that should already be taken care of when the system was set up. The important things are owned by root and normal users should not have write access to directories outside their home directories.
If there are particular directories/files you don't want normal users to even be able to read, you should deal with them individually.
BTW, don't forget to unset the sticky bit for chroot:
chmod -s chroot
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.