Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Every time I restart the computer I have to sudo chmod a+rw /dev/ttyS0 to run any program that uses serial communication.

share|improve this question
add comment

1 Answer

I have to sudo chmod a+rw /dev/ttyS0

That's because udev dynamically creates the ttys on each boot. Without going into why your ttyS0 doesn't work by default, the brute-force solution is to simply add a chmod a+rw /dev/ttyS0 to your /etc/rc.local file (this way it's automatically executed on every boot.)

share|improve this answer
    
Ok, thank you, I'll try it when I get back to work. To give a more comprehensive view of the situation I might also have to add that I have added a path to a program utilizing serial communication in the .profile-file (The sole purpose of the computer is to control an industrial machine). What will execute first, rc.local or .profile? I would like to do it in a more proper way but the google results I got which was dealing with udev and adding the user to dialout etc. didn't seem to apply to 12.04. Files mentioned was not there on my system. –  Paul May 23 '12 at 18:46
    
The difference is that .profile is run on each bash login, while rc.local is executed only once upon boot. In your case, repeatedly setting permissions isn't going to cause any problems, so whatever works for you! –  izx May 24 '12 at 3:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.