1

I have Ubuntu Server 12.04 LTS and on it I have installed gammu. I use it to control my "Nokia 5310 Xpress music" cell phone.

Now when I run "gammu --identify" it does not work, says I dont have the right device permissions, but it works with sudo gammu --identify

Now my Nokia device is listed as ttyACM0 in my /dev/ directory... its permissions are rw for root and dialout... I tried to change these permissions so that I can use this device with gammu without sudo ... I did sudo chmod 777 /dev/ttyACM0 and it changed the permissions, but still it did not work...

I even went and added a file in /etc/udev/rules.d/ by the name of 40-41-descriptive-name.rules which contained the following line:

SUBSYSTEM=="usb", ATTR{idVendor}=="0421", ATTR{idProduct}=="006b", MODE="0600", OWNER="MyUserName"

and then restarted udev but still no luck...

I even did sudo chown myusername /dev/ttyACM0 and gave myself the ownership of the device but still I needed to use sudo to get things done...

btw if I do lsusb I get the following info:

BUS 002 Device 003: ID 0421:006b Nokia Mobile Phones

I tried all these ways to change the device permissions so that i could use "gammu --identify" instead of sudo gammu --identify but no luck.

How can i fix this dilemma?

devav2
  • 37,290
ArslanW
  • 151

3 Answers3

2

Taking help from fellow answers I found the solution to my problem...

In my gammu configuration file I changed the port to /dev/phone

Then I went to /etc/udev/rules/ directory and in it I created a file name 99-phone.rules, then in that file I wrote the following line:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="006b", MODE="0666" , SYMLINK+="phone"

Then I rebooted my system and then when I connected my Nokia phone, I was able to run commands on it without using sudo!

Thanks Everyone especially @firusvg !!

ArslanW
  • 151
1

To avoid potential problems with situation that phone gets recognized as /dev/ttyACM0, /dev/ttyACM1,... or /dev/ttyUSB0, /dev/ttyUSB1,... with subsequent connection/reconnection cycles, make symlink for phone to be like /dev/phone - make 99-phone.rules udev rule with:

KERNEL=="ttyUSB*", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="006b", NAME="phone", MODE="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="006b", NAME="phone", MODE="0666"

and make change for port in .gammurc to be port=/dev/phone. Now, you'll be able to issue gammu commands without sudo.

Of course, remove previous rules in your 40-41-descriptive-name.rules

Please note that two lines in 99-phone.rules are there only to ensure that all possible cases for initial phone recognition are covered (also note MODE="0666" - that will give rw for all users/groups).

This is approach I'm using for my own SMS gateway (using three phones and based on gammu-smsd) and, so far, works well.

firusvg
  • 126
  • 2
0

One should also check Gammu daemon gammu-smsd and it's configuration file. The daemon itself will run as root but then the command gammu-smsd-inject will allow to send sms without root permission as far as the spool directory is writable. Also the good thing is the daemon will take care of receiving message periodically.

CedSha
  • 31
  • 4