Re: UNIX question
Posted in 1998
On Tue, 17 Mar 1998 14:03:55 -0500, Steve Romankiw
<sromankiw@execrisk.com> wrote:
>
>As root, you can send messages to the console by typing "echo hello >
>/dev/console".
>When I try this as any user besides root, I get a message similar to
>"/dev/console: cannot create".
>
>As someone other than root, how would you do something like:
>
><<snip>>
>example# sendtoconsole hello # send
>message to console
>
>example# cat sendtoconsole
>echo $1 > /dev/console>
You could consider the setuid or 'super user bit'.
If the shell script has the owner 'root' just set the permissions as
follows:
chmod 6777 shellscript
and this will mean that anyone running the shell script will have root
permission for the time the shell script is run and thus the shell
script should do as you want.
But be careful about using this facility. When writing shell scripts
with the 'super user bit' set a user could interrupt the program and
be given the shell prompt. From this point on any unscrupulous user
could wreak havoc. You will need to enhance your shell scripts, how
small or innocuous, to cater for interrupts and make sure there is no
way that such a situation could happen.
HTH
Cheers, Ian.
Tedious 'office speak' part 3: "Let's go scuba in the think tank."