perms of /dev/uhid0

Mike Tancsa mike at sentex.net
Wed Nov 26 07:12:07 PST 2003


I wrote a small app that monitors a Back-UPS ES500 UPS via the uhid0 
interface.  I want to run the daemon with as little privs as possible.

gastest# ls -l /dev/uhid0
crw-rw----  1 root  operator  122,   0 Nov 12 05:26 /dev/uhid0
gastest#

Is it safe to chmod o+r /dev/uhid0 ?  Or is there a better way to drop 
privs of the daemon yet still be able to read from the device ?

All I am doing is

char *devname = "/dev/uhid0";

fd = open( devname, O_RDONLY );
         if( fd < 0 ) {
                 perror( "open" );
                 return -1;
         }

  do {
                 count = read( fd, buff, sizeof( buff ) );
	.... rest of the program
--------------------------------------------------------------------
Mike Tancsa,                          	          tel +1 519 651 3400
Sentex Communications,     			  mike at sentex.net
Providing Internet since 1994                    www.sentex.net
Cambridge, Ontario Canada			  www.sentex.net/mike



More information about the freebsd-security mailing list