69

I'm using the Arduino IDE in Ubuntu, and am having issues with the serial port. It has worked in the past, but for reasons that may be unnecesary, I felt the need to change the ownership of some of the files from root ownership to my users ownership.

This made the IDE work correctly, but I lost the ability to use the correct serial port. In the dev folder, the port I need is listed as permission 166. Someone (who is no longer in the area to help me) swapped the permissions to 666, which made it all work gloriously.

However, it reverted back as soon as I restarted my computer, and if I now try to use the command:

sudo chmod 666 ttyACM0

nothing happens. No error messages, but no permission change either.

How can I change it, and how can I get it to change permanently.

I apologize if this question is overly simplistic or unclear, I'm an ubuntu noob, and I wouldn't begrudge feedback!

nelsonda
  • 623
Terrik
  • 803

6 Answers6

100

The issue with the permissions for /dev/ttyACM0 can be permanantly solved by adding yourself to the dialout group.

You can do this with:

  1. sudo usermod -a -G dialout $USER

  2. Logout and then log back in for the group changes to take effect.

Lorenz Keel
  • 9,511
Rinzwind
  • 309,379
21

I couldn't get Rinzwind's suggestion to work, because it complained that the user account already exists. Instead, I used this command to add an existing user (terrik) to an existing group (dialout), as described on the Ubuntu Help Wiki.

sudo adduser terrik dialout

Also useful is this command for listing your current groups, although as Rinzwind says, you have to log out and log in before the serial port starts letting you in.

groups terrik
Don Kirkby
  • 1,489
16

Another possibility is to make a rules file in /etc/udev/rules.d/ directory. I had similar problem and I have created 50-myusb.rules file in the above directory with this content:

KERNEL=="ttyACM[0-9]*",MODE="0666"

Note that this will give any device connected to ttyACM socket read/write permissions. If you need only specific device to get read/write permissions you must also check idVendor and idProduct. You can find those by running lsusb command twice, once without your device connected and once when it is connected, then observe the additional line in the output. There you will see something like Bus 003 Device 005: ID ffff:0005. In this case idVendor = ffff and idProduct = 0005. Yours will be different. Than you modify the rules file to:

ACTION=="add", KERNEL=="ttyACM[0-9]*", ATTRS{idVendor}=="ffff", ATTRS{idProduct}=="0005", MODE="0666"

Now only this device gets the permissions. Read this to know more about writing udev rules.

12

I couldn't get Terrik's answer working, but I could if I made this slight adjustment to the path for ttyACM0.

sudo chmod 666 /dev/ttyACM0

Would post as a comment but I don't have the privileges for that yet...

gbmhunter
  • 221
  • 2
  • 3
2

Try going into System / Users and Groups and checkeing the box on your username in the TTY Group.

Eliah Kagan
  • 119,640
0

This is what I did to solve the problem using virtualbox:

  1. From the tool bar, go to Devices and check the USB list of devices.

Step1

  1. If it's there then you have to add it from the setting.

Step2

Step3

  1. Finally, you can find it on your application.

Step4

R1S8K
  • 133