3

I'm getting the error could not open port /dev/ttyACM0 : [Error 13] Permission denied : '/dev/ttyACM0 '

To solve this error I write the coomand sudo chmod a+rw /dev/ttyACM0 which solves the problem for that active session only. Once I turn off my NUC or restart the same error is thrown again and again.

Sm Ashhar
  • 43
  • 1
  • 1
  • 4
  • 6
    Does this answer your question? [Arduino only works in root](https://askubuntu.com/questions/899374/arduino-only-works-in-root) - use `sudo usermod -a -G dialout $USER `. – N0rbert Mar 23 '20 at 17:17

1 Answers1

1

The /dev directory is recreated at every boot, so your chmod vanishes.

The better way is to determine the group ownership of the device withls -l, then add yourself to that group with sudo adduser $USER group

Here's my expanded explanation:

Open a "terminal window" by pressing Ctrl-Alt-T.

Left Click to select this window.

Explore. Type:

ls -l /dev/ttyACM0
man ls

Fix. Type;

sudo adduser $USER $(stat --format="%G" /dev/ttyACM0 )

When prompted, type your login password.

This will set things up so that your next (and all subsequent) login will have group access to /dev/ttyACM0.

Therefore, logoff, login and be happy.

waltinator
  • 35,099
  • 19
  • 57
  • 93
  • I didn't get what you are recommending. Could you please tell me how to do that. my device username is unity-ubantu – Sm Ashhar Mar 23 '20 at 15:55