8

My system is Ubuntu 13.04 and it works fine, but I have installed VirtuaBox to run Windows XP, which is essential for me to run an application that dialogues with an alarm setup by a USB-to-Serial adapter.

VirtualBox uses ttyS0 as a Serial port and the communication can start efficiently only if command sudo chmod 666 /dev/ttyS0 is given to Terminal.

Every time I boot Ubuntu, ttyS0 permissions return to the default values and I have to run chmod every time I boot-up.

My question is: how can I change /dev/ttyS0 file permission permanently? If this is not a good practice, are there other manners to solve the issue?

2 Answers 2

16

There's no need to change system file's permissions. The serial devices have the following default permissions:

crw-rw---- 1 root dialout ... /dev/ttyS0

So all you have to do is add the user to the dialout group:

sudo adduser $USER dialout
2
  • Thanks Eric, your solution worked for me after rebooting! Claudio :)
    – Claudio
    Nov 12, 2013 at 7:36
  • reboot is not required, re-login es enough. if you don't want to close your session you can also do ssh $USER@localhost (if you have openssh-server installed) and use that terminal.
    – rrosa
    Oct 20, 2014 at 13:45
2

Solution 1: check group of ttyS0 and then assign it to your user,then relogin or su - user

crw-rw---- 1 root dialout 4, 64 feb 28 18:23 /dev/ttyS0
usermod -aG dialout youruser
su - youruser

Solution 2: if you don't like the first solution edit /etc/udev/rules.d/50-tty.rules

KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="whateveryouwant"

restart udev or reboot and of course before add your user to selected group

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .