Screen inside Jails + su

Erik Osterholm freebsd-lists-erik at
Wed Apr 9 00:52:18 UTC 2008

On Wed, Apr 09, 2008 at 12:00:05AM +0200, Wael Nasreddine wrote:
> Hello,
> I have a FreeBSD server which is Jails based, I have created a special
> jail to run 3 rTorrent process for 3 users, I made all the permissions
> and added the users, then I launched manually (for testing purpose)
> these screen sessions for the 3 users using the below method:
> - jexec onto the jail.
> - su to the user: su -l wael
> - run a detached screen: screen -dmS Rtorrent
>   I have a .screenrc for each user in place to run one command,
>   rtorrent
> Now I have 2 questions:
> 1) How can I add this procedure to the jail startup??

The common way for a user to run a program at startup is to use cron
with the special @reboot directive instead of giving it a time to run
a job.

> 2) I can't attach the screen, everytime I try to I get an error:
>      # su -l wael
>      % screen -Dr Rtorrent
>      Cannot open your terminal '/dev/ttyp6' - please check.
>   What's going on? why can't I attach the screen session ??

If you have used jexec to get into the jail, then you won't have a pty
within the jail, and anything which relies on one will fail to
execute.  Start up sshd in the jail, then ssh to it and see if you can
attach the screen.

More information about the freebsd-questions mailing list