Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!exodus!limes From: limes@sun.com (Greg Limes) Newsgroups: comp.unix.questions Subject: Re: Messages to the console Message-ID: Date: 30 Nov 90 10:08:48 GMT References: <25145@adm.brl.mil> Sender: news@exodus.Eng.Sun.COM Lines: 22 In-reply-to: sct60a.sunyct.edu!buck@sct60a.sunyct.edu's message of 29 Nov 90 03:14:41 GMT 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@eng.sun.com "Just One More Bug Fix ..."