GPIO bcm2835.h and permissions?


3 posts
by mad-hatter » Sun Aug 12, 2012 10:22 am
Hello,

New to C
New to linux

Running wheezy raspbian

I've made a small test program in C using the GPIO (bcm2835.h).
Compiled with - gcc -o myprog myprog.c -l bcm2835.

How do I get this file to run as a user/any user (myprog) rather than (sudo ./myprog).

Regards
Posts: 314
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the seaside
by joan » Sun Aug 12, 2012 11:26 am
There are security implications of what you want to do, have a look at http://www.codecoffee.com/tipsforlinux/articles/028.html

To answer your question change the files ownership to root and set the suid bit.

e.g.

sudo chown root:root file
sudo chmod +s file
User avatar
Posts: 5805
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by mad-hatter » Sun Aug 12, 2012 12:15 pm
Hi,

Thanks

Regards
Posts: 314
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the seaside