How to execute "sudo chmod 777 /dev/ttyACM0" from shell script?

I want to give access to serial port /dev/ttyACM0. How to execute the "sudo chmod 777 /dev/ttyACM0" command from shell script ?

4

1 Answer

Giving 777 permission to a file is not at all recommended. Since you want to give access to the Serial port, you have to add the user to the dialout group

sudo usermod -a -G dialout <username>

Now, no permission will be asked while accessing the serial port.

Note that this solution will also work for uploading code to Arudino boards in Arduino IDE or Serial Monitor in Ubuntu.

1

You Might Also Like