My solution (ArchLinux ARM on RaspberryPi) requires that a non-privileged user has to have access to the /dev/ttyAMA0 port. In final implementation that user will be automatically logged in and a start-up script would be launched, but that is off-topic.

The problem is that the /dev/ttyAMA0 port (owned by root:tty) has 0620 permissions, and though the non-privileged user is put in the tty group, the file permissions do not give him read access, and that is not good enough.

In this thread I was told I should use /etc/tmpfiles.d feature to fix the permissions. However, adding a /etc/tmpfiles.d/solution.conf file with one line

F /dev/ttyAMA0 0660 root tty

does not change a thing. Perhaps I am not using the tmpfiles.d feature correctly.

  • That sounds like a job for udev. But 0620 root:tty does give the user read access to the port, so your problem isn't the permissions, unless you meant that the user needs write access (which is plausible, most serial protocols require bidirectional communication). – Gilles 'SO- stop being evil' May 23 '15 at 21:57
  • 1
    I don't know the reasons why the default permissions to the /dev/tty* files in archlinux is rw--w----, what, to my understanding, equals 0620, and means read+write to root and write to tty group. My project indeed needs only write access but the python script fails to initialize if there is no read access, too. – Passiday May 24 '15 at 10:36
  • Oh, sorry, you have write access and you want read access. My bad, I misread your question. – Gilles 'SO- stop being evil' May 24 '15 at 10:55

It turns out that this problem was specific to RaspberryPi, since the /dev/ttyAMA0 serial port that's linked to the hardware GPIO pins by default is initialized for virtual console access.

I had to remove any reference to /dev/ttyAMA0 in /boot/cmdline.txt, reboot, and the /dev/ttyAMA0 now was with proper group permissions (read+write), however the group name now was uucp. What is not problem, of course, to put my user in that group.

Had I wanted to change the ownership of /dev/ttyAMA0 or permissions, that could be done via editing the rule files in the /usr/lib/udev/rules.d directory.

  • 1
    If you want to change the ownership or permissions, add a rule in /etc/lib/udev/rules.d, don't edit the files outside /etc. – Gilles 'SO- stop being evil' May 24 '15 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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