how to 'chmod 777' serial port /dev/ttyACM0 on Ubuntu 16.04 on startup?

A number of blogs suggested that I should type sudo adduser $USER dialout, but it already showed that the $USER is already a member of the group dialout, and when I rebooted the computer, the /dev/ttyACM0 was not given the read/write previlege.

crw-rw---- 1 root dialout 166, 0 Mar 22 13:53 /dev/ttyACM0 

I am not familiar with Ubuntu 16.04, so any help would be appreciated.

1 Answer

You should not make any file, especially a device file, world-writable on your machine. That's a huge security flaw. Group permission policies exist for a reason in the linux kernel. When your user really was a member of the dialout group, then you'd already have read and write permission on that file. Type id on the command line to list all the groups your user is in. Is dialout in that list? If not, then you have to add it. sudo adduser $USER dialout should be fine to add $USER to dialout group, but this is a Ubuntu-specific wrapper, the correct way to do add your user to dialout group on linux would be sudo usermod -aG $USER dialout. Check if that works better. You can also try cat /dev/ttyACM0 to see if your user really has read permission on that file, if it hadnt, youd get a Permission denied error.

If your user is member of the dialout group, but your application still can't access that device, then make sure your application is really run as your user, or not as another user because of e.g. a startup script. Also make sure that it's really that file that is blocking your application from working and not something else. You'd need to provide further information for that matter.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like