User avatar
mad-hatter
Posts: 419
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the UK seaside

GPIO bcm2835.h and permissions?

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

User avatar
joan
Posts: 12744
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO bcm2835.h and permissions?

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/ ... s/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
mad-hatter
Posts: 419
Joined: Sun Feb 26, 2012 2:58 pm
Location: By the UK seaside

Re: GPIO bcm2835.h and permissions?

Sun Aug 12, 2012 12:15 pm

Hi,

Thanks

Regards

Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 5 guests