[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Little problem with rights on a script



On Sunday 17 November 2019 11:05:36 tomas@tuxteam.de wrote:

> On Sun, Nov 17, 2019 at 10:07:23AM -0500, Gene Heskett wrote:
> > On Sunday 17 November 2019 09:59:52 Nicolas George wrote:
> > > Gene Heskett (12019-11-17):
> > > > i have a similar situation with heyu, which runs as a normal
> > > > user. But udev insists all the ttyUSB# ports are root:root, so
> > > > I've put a couple lines in my rc.local for the last decade or so
> > > > to make me own
> > >
> > > You could have read the doc for udev instead of wasting your time
> > > on a fragile solution.
> > >
> > > Regards,
> >
> > The docs for udev are too paranoid to show one how, and the next
> > package upgrade undoes your work anyway so why bother.
>
> Sorry, but man 7 udev seems pretty clear to me. A bit terse, yes, but
> complete and useful enough whenSomething like
>
>   KERNEL=="ttyUSB0", MODE="0660", GROUP="dialout",
>
I am and always have been a member of group dialout. Didn't work.

> should roughly do (perhaps DEVPATH instead of KERNEL -- whatever
> floats your boat). Go have a look into
>
>   /lib/udev/rules.d/80-debian-compat.rules
included here to show lack of clarity:

# Debian specific udev rules for backwards compatibility

# needed for old tape drivers, http://bugs.debian.org/657948
SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", 
RUN{builtin}+="kmod load sg"

# device permissions
KERNEL=="mISDNtimer", GROUP="dialout"
KERNEL=="mwave", GROUP="dialout"
KERNEL=="nvram", GROUP="kmem", MODE="0640"
KERNEL=="pktcdvd", GROUP="cdrom", MODE="0644"
KERNEL=="lirc[0-9]*", GROUP="video"
KERNEL=="legousbtower*", MODE="0666"
KERNEL=="sonypi", MODE="0666"
KERNEL=="mmtimer", MODE="0644"
KERNEL=="sgi_*", MODE="0666"
KERNEL=="z90crypt", MODE="0666"

# These rules will create symlinks for CD/DVD drives, to help old
# programs which are unable to automatically discover the devices.
# The first detected device gets the symlink, but this is not stable 
across
# reboots.
ENV{ID_CDROM_CD_RW}=="?*", \
  PROGRAM="/bin/sh -c 'ln -s %k /run/udev/link.cdrw 2>/dev/null; [ 
`readlink /run/udev/link.cdrw` = %k ]", \
  SYMLINK+="cdrw", OPTIONS+="link_priority=-100"
ENV{ID_CDROM_DVD}=="?*", \
  PROGRAM="/bin/sh -c 'ln -s %k /run/udev/link.dvd 2>/dev/null; [ 
`readlink /run/udev/link.dvd` = %k ]", \
  SYMLINK+="dvd", OPTIONS+="link_priority=-100"
ENV{ID_CDROM_DVD_RW}=="?*", \
  PROGRAM="/bin/sh -c 'ln -s %k /run/udev/link.dvdrw 2>/dev/null; [ 
`readlink /run/udev/link.dvdrw` = %k ]", \
  SYMLINK+="dvdrw", OPTIONS+="link_priority=-100"

Doesn't appear to be complete, I see no mentions of the ttyUSB# family of 
devices,and no suggestions as to how to edit it.

So I reasoned that by the time it got to rc.local, udev would have gone 
away and as rc.local runs with root privs, I could do what needed to be 
done in rc.local, so I did and its worked for yonks. And since heyu is 
not officially in the repos due to a licencing incompatibility, the only 
place to ask for help is heyu.  Shrug, its your OS, but its my machine.

> to get an idea of how to set permissions on special device files.
>
> And oh, the standard convention here is to use some special group
> for a device file and to add those users supposed to much around
> with that device to said group (e.g. "dialout", "cdrom", you name
> it -- Debian comes with a bunch of those). Then you can set the
> device to 0660, not 0666.
>
> But those are just advises. It's your box.
That it is. ;-)

Thanks Tomas.

> Cheers
> -- t


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>


Reply to: