up vote 0 down vote favorite
1
share [g+] share [fb]

I'm using bluetooth on linux to access internet via dialup from my Nokia S60 phone. I've gotten the connection to work just fine, but there's still one recurring problem:

Some Nokia S60 phones, mine included, have the habit of changing the channel they offer their Dial-Up Networking service on. One day it's 2, the next day it may be switched to 9. For linux, this means that each time it happens I have to go edit the /etc/bluetooth/rfcomm.conf to contain the right channel and then use "/etc/init.d/bluetooth restart" to reboot the bluetooth service.

I've created a script to do all this for me, and granted edit rights to the rfcomm.conf - but restarting the bluetooth service still needs super-user rights. I'd rather not have to type my password every time the phone feels a need to juggle channels, so:

How do I grant the user access to restart the bluetooth service? Preferably without breaking too much of my access control - so granting the user full root-level access is not a solution. :)

link|improve this question

feedback

2 Answers

up vote 2 down vote accepted

Add

Cmnd_Alias BT=/etc/init.d/bluetooth
username ALL=NOPASSWD: BT

to your /etc/sudoers file. Don't forget to change username though :)

This will allow you to run sudo /etc/init.d/bluetooth restart without entering the password but sudo will still ask for it when you run it with any other application.

link|improve this answer
Perfect! Thanks! – Ilari Kajaste Sep 11 '09 at 14:39
feedback

sudo or is there a bluetooth group you can add them to or does that just run the daemons?

link|improve this answer
No bluetooth group, at least not with an explicit name. sudo not really an option, since I don't want to be typing the password every time. – Ilari Kajaste Sep 11 '09 at 7:54
You can configure sudo so it won't ask for password for that particular script :) – vava Sep 11 '09 at 13:47
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.