On Thu, Oct 22, 2020 at 10:30:17PM +0000, mike.junk...@att.net wrote: > For years under sysvinit, in /etc/inittab, this line: > kb::kbrequest:$( [ "`id -u`" -eq 0 ] && /bin/openvt -su || sudo /bin/openvt > -su) > allowed me to open another VT by keying Control-UpArrow.
What a cargo-culted mess. Mixing both forms of command substitution syntax is sure sign that someone "borrowed" some code that they don't understand, and then banged on it with a rock until it appeared to work some of the time. Why do you even need a check for the user ID of a program spawned by init? It's always root. > I've had no luck generating that same functionality under systemd. > If anyone else has managed to do this I'd sure appreciate a primer. So, I searched google for "systemd equivalent kbrequest", and it gave me <https://www.freedesktop.org/software/systemd/man/systemd.html>. It has a section about a unit named kbrequest.target, under the heading of SIGWINCH (very comparable to what the init/inittab man pages show). So, I would imagine what you want to do is place your command in a customized kbrequest.target unit, which you would create under /etc. And skip all that dumb ID-checking shell wrapper code, because it always runs as root anyway.