Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Run applications as another user without switching' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Run applications as another user without switching
Authored by: Felix_the_Mac on May 21, '04 10:25:06AM

I have been trying to get chroot to work which will add further security to this approach. chroot sets the root directory for a process so that it cannot access anything outside a particulat directory structure e.g. /users/dummy

However whenever I issue the chroot command I get the following errors:


Felixs-Computer:/ Felix$ chroot /jail
chroot: /jail: Operation not permitted
Felixs-Computer:/ Felix$ sudo sh
Password:
sh-2.05b# chroot /jail
chroot: /bin/bash: No such file or directory
sh-2.05b# chroot /jail /bin/bash
chroot: /bin/bash: No such file or directory
sh-2.05b#
sh-2.05b#

any help would be appreciated!



[ Reply to This | # ]
Run applications as another user without switching
Authored by: kianga on May 21, '04 10:48:51AM

Regarding chroot, I seriously doubt that this is going to work. When you use chroot, everything else above the new root directory becomes inaccessible.

This includes things like the shell (/bin/bash), but more importantly all the system frameworks (e.g. Cocoa), which are located in /System/Library/Frameworks.

Basically, you have to copy all important system files into the appropriate directories below the chrooted directory, e.g. /jail/System/Library/Frameworks, /jail/bin/bash, etc. Also, the /Volumes directory wouldn't be available either.

Using a chroot on a GUI-less UNIX server is difficult enough; I doubt it will work on a system as complex as OS X.



[ Reply to This | # ]
chrooting OSX works fine
Authored by: daniel_steffen on May 25, '04 11:57:57AM

it's perfectly possible and very useful, see
http://darwinports.gene-hacker.net/docs/howto/chroot_10.2/
you have to set aside ~ 4GB for a disk image containing the chroot though



[ Reply to This | # ]
Chroot Probelm
Authored by: CrazyDuke on May 21, '04 10:55:04AM

I think your problem is that initially you were not allowed to do it, but when you did "sudo sh" you created a new shell but I don't think any of the path information was passed along. You should simply do "su -" (that is the same command above without a user) and that will prompt you for your root password and you will then be in as root.

Reason I say this is that "chroot: /bin/bash: No such file or directory" is referring to the command "chroot" it can't find it cuz there probably is no path variable set.

Now as far as whether it won't work due to losing frameworks, etc, I don't know I guess that's something you'll have to try.



[ Reply to This | # ]
Chroot Probelm
Authored by: thochman on May 22, '04 07:19:55PM

Reason I say this is that "chroot: /bin/bash: No such file or directory" is referring to the command "chroot" it can't find it cuz there probably is no path variable set.

Actually, it's chroot saying that /bin/bash cannot be found. If it was bash, the line would start with "bash" and not "chroot". :) The reason this is occurring is because chroot is using /jail as the / directory. Well, since no command is specified, chroot attempts to load up a shell. Namely, /bin/bash. If there's no /jail/bin/bash then chroot spits out the error seen here.



[ Reply to This | # ]