Solved Assign ttys to jail

Is it possible to assign a few ttys to a specific jail such that I can bypass jexec <jail name> and instead switch to a specific tty and log into that jail?
 
Theoretically I would presume replacing some of the getty(8) processes in /etc/ttys to something like cu(1) linked to specific mndn(4) devices is possible. Never tried it but I suspect it can be made to work.
 
Ok, so perhaps I need to update devfs and then in the jail /etc/ttys, refer to the appropriate tty device?
 
Wait, sorry, I was somehow thinking about bhyve(8) vms actually, not jails. That said, have you tried replacing getty(8) in /etc/ttys with a jexec <jailid> "/usr/libexec/getty Pc". Maybe that'll work. Or jexec <jailid> /usr/bin/login. Again, never tried it myself.
 
Brilliant:
jexec <jailid> "/usr/libexec/getty Pc

worked on the cmdline. I think the tricky part will be that as the jail takes some time to start, I may run into some issues with that, but it is worth trying.
 
I am failing to remember how to restart getty after making changes to /etc/ttys short of restarting the computer which is not a great approach. My changes to /etc/ttys didn't work, so I need to tweak it more, but don't want to restart after every change.
 
init(8):
Code:
     Line status (on, off, secure, getty, or window information) may be
     changed in the ttys(5) file without a reboot by sending the signal SIGHUP
     to init with the command “kill -HUP 1”.
 
Back
Top