SlackwareThis Forum is for the discussion of Slackware Linux.
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.
Im reading the man page but its short and it doesnt show examples......I want to chroot jail /home/example so that my user 'example' cannot cd into other directories?
The chroot command is used to make a new root folder, this means that anyone, user or command, are totally unable to reach ANYTHING outside of that directory branch. So if you would set another root for a user he wouldn't be able to do anything (if he would be able to login at all), since all commands are outside of his "root-jail".
i am trying to execute chroot command but i was not successful
chroot /mnt/ubuntu dpkg -i somepackage-name
I guess that dpkg is to be found in your Ubuntu somwhere inside /mnt/ubuntu so it's not in root's $PATH when you run that command from Slackware.
This also answers you other question: try a command which is in root's path.
PS I just saw that you asked a similar question here. I'd suggest you open your own thread to attract more attention, including all details needed for the readers to understand what you try to achieve.
To do that, just go back there and hit "New thread".
Last edited by Didier Spaier; 02-23-2013 at 02:36 AM.
The chroot command is used to make a new root folder, this means that anyone, user or command, are totally unable to reach ANYTHING outside of that directory branch. So if you would set another root for a user he wouldn't be able to do anything (if he would be able to login at all), since all commands are outside of his "root-jail".
The jail would contain copies of selected commands and files. The plash C library tool can provide limited communication with outside.
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Have you looked at starting the user shell (probably BASH) in restricted mode? Form the manual page for BASH:
Quote:
restricted_shell
The shell sets this option if it is started in restricted mode (see
RESTRICTED SHELL below). The value may not be changed. This is not
reset when the startup files are executed, allowing the startup
files to discover whether or not a shell is restricted.
If bash is started with the name rbash, or the -r option is supplied at invocation,
the shell becomes restricted. A restricted shell is used to set up an environment
more controlled than the standard shell.
Seems like that's what you're really trying to do (the user cannot CD anywhere). Simply change the shell for the user in /etc/passwd from /bin/bash to /bin/rbash.
C'mon guys, don't feed the zombies. This was a NINE years old thread. The person who is trying to resurrect the thread apparently needs two posts (out of his LQ total of three) to ask the same Ubuntu-related question. This is a Slackware forum thread!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.