When I first got started with Arduino under Linux, I quickly discovered that I had issues connecting to the Arduino to program it or talk to it via serial. I later found the same issue when I started working with 3D Printers, when trying to connect the host application to the printer to operate it.
This was clearly a permissions problem, as all of these cases (and other USB serial devices) worked just fine when run as root (not a good practice, don’t do this). This is just a quick post showing how to set yourself up with the permissions needed to use these devices as a normal user.
Finding the User Group
You’ll grant yourself the relevant permissions by adding yourself to the appropriate user group. To do that, you’ll need to find out which user group owns the device you want to talk to. Use the following command and find your device:
ls -l /dev
You should get a long string of results, one line of which will look something like this:
crw-rw—T 1 root dialout 4, 67 Mar 2 19:39 ttyUSB0
In this case (CrunchBang Linux), ttyUSB0 is the device we’re concerned with and dialout is the group that owns it, along with the root user. Note that the permissions on the device are the same for the group as for root. Remember this group name.
Add Your User Account to the Group
Adding your user account to a group is simple. In a terminal, just run this command:
sudo addusr <username> dialout
Of course, replace <username> with your actual user name, and dialout with the name of the group if this was different on your system.
You’ll have to log out and log back in, restart your computer, or execute commands within a new shell for these changes to take effect. A restart is foolproof, but logging out and back in generally does the job without the wait of a restart.
Now, just run your application, whether a serial terminal, 3D Printer host application, the Arduino programmer, or anything else. You should now be able to access your device with your normal user.