Active Topics

 


Reply
Thread Tools
Posts: 20 | Thanked: 11 times | Joined on Apr 2010
#1
Hi

I'm writing an app in Qt using NokiaQtSDK to make the n900 become a handsfree device.

I need to call the bluez function to change the device class but it required that my application have superuser access (root access).

What's the best way to achieve this?

Last edited by anistein; 2010-10-02 at 13:13.
 
MohammadAG's Avatar
Posts: 2,473 | Thanked: 12,265 times | Joined on Oct 2009 @ Jerusalem, PS/IL
#2
Add a file in /etc/sudoers.d/ (take a look at the files there, there are a lot of examples )
then execute update-sudoers in your postinst and postrm files.

After that you can just use sudo.
 

The Following 2 Users Say Thank You to MohammadAG For This Useful Post:
Posts: 20 | Thanked: 11 times | Joined on Apr 2010
#3
Originally Posted by MohammadAG View Post
Add a file in /etc/sudoers.d/ (take a look at the files there, there are a lot of examples )
then execute update-sudoers in your postinst and postrm files.

After that you can just use sudo.
Thanks for your response, I don't know the exact mechanics but i'll look into it. Progress
 
Posts: 20 | Thanked: 11 times | Joined on Apr 2010
#4
Originally Posted by MohammadAG View Post
Add a file in /etc/sudoers.d/ (take a look at the files there, there are a lot of examples )
then execute update-sudoers in your postinst and postrm files.

After that you can just use sudo.
What is the command for update-sudoers?
 
MohammadAG's Avatar
Posts: 2,473 | Thanked: 12,265 times | Joined on Oct 2009 @ Jerusalem, PS/IL
#5
update-sudoers

Code:
#!/bin/sh

update-sudoers
exit 0
Sample .sudoers file
Code:
Nokia-N900:~# cat /etc/sudoers.d/psfreedom.sudoers 
user ALL = NOPASSWD: /usr/sbin/psfreedom-disable-n900.sh
user ALL = NOPASSWD: /usr/sbin/psfreedom-enable-n900.sh
user ALL = NOPASSWD: /opt/psfreedom/resources/helpimages/modelimages.sh
user ALL = NOPASSWD: /opt/psfreedom/resources/scripts/helperscript.sh

Last edited by MohammadAG; 2010-10-02 at 14:19.
 

The Following User Says Thank You to MohammadAG For This Useful Post:
Posts: 20 | Thanked: 11 times | Joined on Apr 2010
#6
Originally Posted by MohammadAG View Post
update-sudoers

Code:
#!/bin/sh

update-sudoers
exit 0
Sample .sudoers file
Code:
Nokia-N900:~# cat /etc/sudoers.d/psfreedom.sudoers 
user ALL = NOPASSWD: /usr/sbin/psfreedom-disable-n900.sh
user ALL = NOPASSWD: /usr/sbin/psfreedom-enable-n900.sh
user ALL = NOPASSWD: /opt/psfreedom/resources/helpimages/modelimages.sh
user ALL = NOPASSWD: /opt/psfreedom/resources/scripts/helperscript.sh
Thanks for the response again.
I studied the bluemaemo project source because it uses this sort of mechanism. It uses the debian rules file to copy the .sudoers file into the directory.
 
MohammadAG's Avatar
Posts: 2,473 | Thanked: 12,265 times | Joined on Oct 2009 @ Jerusalem, PS/IL
#7
Yeah, you need to install it in /etc/sudoers.d as I said above, I use debian/install and dh_install in debian/rules (which is cleaner imo), see the source of psfreedom
 

The Following User Says Thank You to MohammadAG For This Useful Post:
Posts: 20 | Thanked: 11 times | Joined on Apr 2010
#8
Originally Posted by MohammadAG View Post
Yeah, you need to install it in /etc/sudoers.d as I said above, I use debian/install and dh_install in debian/rules (which is cleaner imo), see the source of psfreedom
On last question: How can I test it on the device using the NokiaQtSDK connection to the device? Is there a place I can modify the automatically generate rules file before it's generated?
 
MohammadAG's Avatar
Posts: 2,473 | Thanked: 12,265 times | Joined on Oct 2009 @ Jerusalem, PS/IL
#9
Hmm, I think you need to edit the .pro file, when I'm done with a C++ app I usually just take it out of the SDK.

See facebrick's .pro file (from it's source)
 

The Following User Says Thank You to MohammadAG For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 01:51.