Re: Send a message to a user's terminal
Bill Marcum wrote:
> On 21 Aug 2006 09:38:24 -0700, gineraso
> <gineraso@gmail.com> wrote:
>
>>I wrote a scipt to kick unauthorized user's off my Solaris 9
>>workstation. Before I kill their session, I'd like to send a message
>>to their session with something like: "You are not authorized to use
>>this workstation. Your session will be killed."
>>
>>I've tried talk but I just want to send one message from command line
>>Something like:
>>
>>echo "You are not authorized to use this workstation. Your session will
>>be killed." {Session}
>>
>>Any suggestions?
>>
>
> If your script runs as root, you can get the device name of the user's
> tty, and redirect the echo to that device. Or, if the user is using X,
> open an xterm displaying the message on their display (you'll have to
> use xauth).
>
>
Or you can use write. This may not work, depending on how your
system is configured. Since write talks to a terminal, it
also won't work if your user is logged on to an X display
manager and has no terminals up, since there's nobody to
write to. It will find his pseudo-terminal if he's running
a terminal emulator in X, however.
Chris Mattern
|