ttyS0 permissions change after reboot

Hello,

I have to change permissions on ttyS0 because I have to sent sms as
regualar user from inside a program.
When I change to:

chmod o+rw /dev/ttyS0

everything works, but when I reboot, my permissions are set to standard
and I can't sms anymore.

How can I change this so that the permissions are still the same after a
reboot.

System is debian etch 2.6.18.3

Grtz,
Verus.

Disclaimer :

This e-mail is intended for the exclusive use by the person(s) mentioned as recipient(s).
If you are not the intended recipient, please notify us immediately.
This e-mail does not constitute any commitment for Sea-Ro Terminal N.V. or its subsidiaries except when expressly otherwise

agreed in a written agreement between the intended recipient and the originating subsidiaries of Sea-Ro Terminal N.V.
Sea-Ro Terminal and each of its subsidiaries each reserve the right to monitor all e-mail communications through its networks.

This mail has been checked for viruses by Symantec and Trend Micro.

0

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

ttyS0 permissions change after reboot

On Tue, Mar 06, 2007 at 03:15:22PM +0100, debian wrote:
>
> Hello,
>
> I have to change permissions on ttyS0 because I have to sent sms as
> regualar user from inside a program.
> When I change to:
>
> chmod o+rw /dev/ttyS0
>
> everything works, but when I reboot, my permissions are set to standard
> and I can't sms anymore.
>
> How can I change this so that the permissions are still the same after a
> reboot.

Wrong approach:

$ ll /dev/ttyS0
crw-rw---- 1 root dialout 4, 64 2002-11-26 02:50 /dev/ttyS0

Add your unprivileged user to the dialout group.

Regards,

-Roberto
--
Roberto C. Sanchez
http://people.connexer.com/~roberto
http://www.connexer.com

ttyS0 permissions change after reboot

If only that simple solution actually worked for me. My issue
was trying to run the "cu" program as root to an external modem,
and I was always getting "Permission denied" errors, even after
adding all sorts of users to the dialout group. Admittedly cu
does all sorts of funky things as it starts, including changing
to uucp:root. You can see an strace of this behaviour at

http://www.debian-administration.org/users/simonw/weblog/36

A thread on the Ubuntu forums from a year ago has the beginnings
of the real answer:

http://ubuntuforums.org/showthread.php?t=143829

Alas, things have changed from that description of the udev
permissions. I am running Debian testing. The referenced
directory, /etc/udev/permissions.d, no longer exists, as explained
here:

http://wiki.archlinux.org/index.php/DevFS_to_Udev

In particular, the permissions.d directory has been removed, and
the permissions put into the rules.d/udev.rules file are all that
count. In addition, on my system rules.d/020_permissions.rules
is a symlink to ../permissions.rules. Also, the syntax from the
Ubuntu forum, such as

ttyS0:nut:nut:600

is no longer valid. At least, it didn't work for me when I tried
it in a udev.d/00-my.rules file all by itself.

After reading the tutorial on writing udev rules at

http://reactivated.net/writing_udev_rules.html

I knew enough to work it out. On my system, I ran

find /sys -name dev | grep ttyS0

which returns

/sys/class/tty/ttyS0/dev
Then I ran

udevinfo -a -p /sys/class/tty/ttyS0

which returned

looking at device '/class/tty/ttyS0':
KERNEL=="ttyS0"
SUBSYSTEM=="tty"
DRIVER==""
ATTR{dev}=="4:64"

looking at parent device '/devices/pnp0/00:0e':
KERNELS=="00:0e"
SUBSYSTEMS=="pnp"
DRIVERS=="serial"
ATTRS{id}=="PNP0501"

looking at parent device '/devices/pnp0':
KERNELS=="pnp0"
SUBSYSTEMS==""
DRIVERS==""

I built the following one line rule (be careful with == vs. =):

SUBSYSTEM=="tty", KERNEL=="ttyS0", OWNER="uucp"

and I put it in the file /etc/udev/rules.d/00-my.rules

That works just fine for me, leaving /dev/ttyS0 after reboot as

$ ls -al /dev/ttyS0
crw-rw---- 1 uucp dialout 4, 64 2007-09-12 12:19 /dev/ttyS0

If I wanted to change the permissions and not just the owner,
I might have to move this line to 99-my.rules, as other lines in
the permissions.rules file change all the tty devices, and from
my reading of the udev rules, the last line wins. But I have
not tested this. By keeping my one line in a separate file, I
am somewhat protected from upgrades which will replace the main
rules files.

cu is very happy now, and the original problem, which was:

# cu -l /dev/ttyS0
cu: open (/dev/ttyS0): Permission denied

is solved.

Best regards,

Lester

Syndicate content