Subject: bin/21568: shutdown gets permission denied error from wall
To: None <>
From: Martin Husemann <>
List: netbsd-bugs
Date: 05/14/2003 00:34:02
>Number:         21568
>Category:       bin
>Synopsis:       shutdown gets permission denied error from wall
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 13 22:35:01 UTC 2003
>Originator:     Martin Husemann
>Release:        NetBSD 1.6T
System: NetBSD 1.6T NetBSD 1.6T (PORTER) #0: Mon May 12 12:47:55 CEST 2003 i386
Architecture: i386
Machine: i386

The test program attached below works when run in an xterm as a normal
user, but fails when run as root:

[/tmp] martin@night-porter > ./blah 
Broadcast Message from                         
        (/dev/ttyp5) at 0:25 CEST...                                           

[/tmp] root@night-porter # ./blah 
[/tmp] root@night-porter # wall: /dev/ttyp5: Operation not permitted

The same happens when you run shutdown from within an xterm. (This might be
a kernel problem, I stared a few seconds at a ktrace, and there are some

  1037 wall     CALL  ioctl(0x3,TIOCGETA,0xbfbff6f0)
  1037 wall     RET   ioctl -1 errno 25 Inappropriate ioctl for device
  1037 wall     CALL  close(0x3)

and similar sequences, but that's not realy the expected error message...)


Compile and run this as normal user and as root in an xterm:

#include <stdio.h>
#include <unistd.h>

int main()
	FILE *f = popen("/usr/bin/wall -n", "w");
	fprintf(f, "test\n");
	return 0;