How do I permanently change permissions for /dev/ttyS0?

30,686

Solution 1

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

Solution 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

Share:
30,686

Related videos on Youtube

Claudio
Author by

Claudio

Updated on September 18, 2022

Comments

  • Claudio
    Claudio over 1 year

    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?

  • Claudio
    Claudio over 10 years
    Thanks Eric, your solution worked for me after rebooting! Claudio :)
  • rrosa
    rrosa over 9 years
    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.