7

How do I allow a user to use SCREEN on a chrooted user?

I have tried everything but I keep on failing.

I need the user to be able to use SCREEN when they are logged in bash as a chrooted user.

Oliver Salzburg
  • 89,072
  • 65
  • 269
  • 311

2 Answers2

6

SCREEN probably needs devpts, the pseudo-terminal filesystem, to be mounted on /dev/pts inside the chroot.

mount -t devpts none "$rootpath/dev/pts" -o ptmxmode=0666,newinstance

ln -fs "pts/ptmx" "$rootpath/dev/ptmx"

(The newinstance flag is optional; it gives the user a completely separate pty list, preventing them from knowing what other users are logged in.)

grawity
  • 501,077
1

In out-of-stock Ubuntu-14.04 this also can be achieved with one "mount" and one "chmod".

Here is /mnt/old is chroot's target directory (new "root"). Also assumed user user belongs to group of /mnt/old/run directory (will be a /run in chroot-ed environment).

sudo mount --bind /dev/pts /mnt/old/dev/pts sudo chmod g+w /mnt/old/run sudo chroot --userspec=user:user /mnt/old screen

Caveats: Not sure if sharing of /dev/pts is really a good idea from security perspective, and I would not recommend this method if security is of concern.

Georgiy
  • 11