-2

I'm having trouble with users in a chroot under Debian GNU/Linux.

I have created a chroot for the stable distribution using debootstrap.

I enter the chroot by using the following script

#!/bin/sh -v
mount proc /debian-new/proc -t proc
mount sysfs /debian-new/sys -t sysfs
mount --bind /dev /debian-new/dev
mount --make-rslave /debian-new/sys 
mount --bind /dev/pts /debian-new/dev/pts
mount --rbind /dev /debian-new/dev 
mount --make-rslave /debian-new/dev
chroot debian-new /bin/bash

I've copied the files /etc/password /etc/shadow /etc/group from the main system in my chroot

But when trying to change to an unprivilaged user I get:

# su pablo
Cannot execute /bin/bash: Permission denied

(inside the chroot)

Also apt-get install prints this warning message

W: Download is performed unsandboxed as root as file '/var/cache/apt/archives/partial/libpython2.7-minimal_2.7.13-2+deb9u2_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

Please help me!

  • 1
    what is the output of ls -l /bin/bash? – ctrl-alt-delor Mar 29 '18 at 23:25
  • Is /debian-new mounted `noexec? – Hauke Laging Mar 30 '18 at 11:33
  • No. It is part of the main filesystem. Where all the /home directories are... – Pablo De Napoli Mar 30 '18 at 13:35
0

I have found the reason. The directory of the chroot was owned by root. Others didn't have read permission over it.

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.