Messages to the console

Greg Limes limes at sun.com
Fri Nov 30 21:08:48 AEST 1990


This may be too simple :-)

Permissions are only checked during the open; so, open /dev/console
once at the top. After that, it doesn't matter how the permissions
change, or how the ownership changes.

Now, just log in to the console (should set owner of /dev/console to
you), start your program, and log out.

The other alternative is to make your program Set-GROUP-Id to the
group called "tty", assuming your system follows the idea of using the
group-writable bit to allow messages, and keeps all terminal lines
owned by group "tty".

If all above fails, make the program setuid-root; open /dev/console
once at the top, then do a "setuid(getuid())" to change the user-id
back to the real calling user-id so the rest of the program executes
with the privileges of the user. If you do this, CAREFULLY examine
every line of code executed while setuid root.
--
Greg Limes   limes at eng.sun.com
	"Just One More Bug Fix ..."



More information about the Comp.unix.questions mailing list