Getting console messages in X
As a system administrator, I like to see console messages even when I'm in X (which is almost all of the time). On my systems, console messages come from high priority kernel messages, high priority notes from syslog, and sometimes messages from init, and I like to know about all of these.
In theory, xterm's
-C command line switch should do this
nicely, and indeed it did for years. These days, there are
two unfortunate problems with it:
- back in 2001 or so, the xterm people decided that
-Cshould quietly ignore your request if you didn't own
- around about the 2.6.9 or 2.6.10 kernel, the Linux kernel people decided that you couldn't redirect console messages unless you were root.
I strongly disagree with xterm's paranoia, since it's pointless if
xterm is unprivileged (which it almost always is, and the code could
always just check). If xterm has no special privileges, the user can
just write their own program to do the appropriate
operation; all blocking
-C from working does is inconvenience
So back in 2001 I grumbled and wrote my own ten line program to do the
TIOCCONS ioctl, and there things sat until recently.
Getting around the 'only root can use
TIOCCONS' problem is a little
bit more work. Since I'm the only user of my machine, I just made my
getconsole program from 2001 setuid root and group-executable only
by me. A more general solution would be a program that checks the
ownership or permissions of
/dev/console and only does the
TIOCCONS if the person running it has appropriate access.
It's possible that
xconsole in recent distributions already does
this, but I personally suspect not. Certainly the Fedora Core 4
version shows no likely signs of this.