2

Lets say I boot up my computer and I see the login screen. When I log in as myuser, I want to be restricted to a certain root directory via. chroot.

Let's assume that the directory is /chroots/myuser/. Is this possible to do ? If so, how would it be accomplished ?

Note:
Just to be clear, I want to change the root directory, not the home directory. The new root directory for the user will contain another OS like Debian.

6

Change the user's default shell in /etc/passwd to the command (or a wrapper script for that command) that logs that user into the chroot.

  • 2
    I think maybe you will then want a separate /etc/password inside the chroot which lists bash, see eg. here: olivier.sessink.nl/jailkit/howtos_ssh_only.html – goldilocks Jan 14 '13 at 12:58
  • 2
    @goldilocks I use schroot which has a -s flag, with which you can set the shell for the user that you log in as. It also updates the user in /etc/passwd to use that shell (in the chroot environment). – user1973386 Jan 14 '13 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.