# screen in chrooted jail

## yszhang

I am trying to setup jail env allow user to run screen, who will snoop regular user screen sessions. I followed http://gentoo-wiki.com/HOWTO_Jail and http://gentoo-wiki.com/HOWTO_Snoop_terminal_session#Screen, besides that I jailadduser each regular users, addjailsw screen, chmod ug+s /var/chroot/usr/bin/screen, then created dir /var/chroot/var/run/screen, and did soft link of each S-users from /var/run/screen.

but still got error message "Must be connected to a terminal." dev are mounted BTW

/dev on /var/chroot/dev type none (rw,bind)

none on /var/chroot/dev/pts type devpts (rw)

Can anyone have same setup help me?

----------

## embobo

You need /proc mounted as well:

```

freddy ~ # linux32 chroot /nfsroot/fantastico /bin/bash

freddy / # screen

Must be connected to a terminal.

freddy / # exit

freddy ~ # mount --bind /proc /nfsroot/fantastico/proc

freddy ~ # linux32 chroot /nfsroot/fantastico /bin/bash

freddy / # screen

[screen is terminating]

freddy / #

```

----------

## yszhang

Thanks, that fix the device problem, but I still can't get everything works. the setup is to allow chrooted user snoop regular user. when regular user start screen, socket is under /var/run/screen. I cant manage chrooted user to see that socket. it doesnt like link. 

screen -r foo/

Cannot access /var/run/screen/S-foo: Too many levels of symbolic links

Can you share your setup, or if you know some good resource that I can reference. Thanks alot.

----------

