Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 2003 10:16:09 -0500
From:      Mike Tancsa <mike@sentex.net>
To:        freebsd-security@freebsd.org
Subject:   perms of /dev/uhid0 
Message-ID:  <6.0.1.1.0.20031126101602.06e8e9f0@209.112.4.2>

next in thread | raw e-mail | index | archive | help

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@sentex.net
Providing Internet since 1994                    www.sentex.net
Cambridge, Ontario Canada			  www.sentex.net/mike



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6.0.1.1.0.20031126101602.06e8e9f0>