On Tue, 2008-04-29 at 23:05 +0100, Christian Koerner wrote:
> Philip Creevy wrote:
> > cat returns pico:x:502:bob
> > ls -l of /dev/bus/usb/001/009 returns
> > crw-rw---- 1 root pico 189, 8 Apr 29 22:08 /dev/bus/usb/001/009
> >
> > A script is checking that the user is in the pico group with
> >
> > username=$(id -un)
> > usergroups=$(id -Gn) id -Gn returns bob at the command line
> >
> > # Determine whether the user is in the group of the file
> > grouptest=$(echo \ $usergroups\ | sed "s/.*\ \($group\)\ .*/\1/")
> >
> > I'am not a sed person so I would not know if the above is correct or not
> > but it does work when logged in as root
> >
> Do you mean the script works when you are logged in as root or just the
> line when you test it on the command line?
>> Your line seems to be ok, at least with the following test:
> --
> [@joe:~]$ export TEST=`id -Gn |sed "s/.*\ \(audio\)\ .*/\1/"`; echo $TEST
> audio
> [@joe:~]$
> --
>> You can add on the beginning of the bash script (if it's bash) the
> following :
> set -xv
>> That gives you some more details when the script runs.
>>> cya,
> Christian
>The main idea is to allow a group called pico access to a USB peice of
hardware and so for anybody in the pico group to access this hardware.
Where the script is falling down is when it checks the groups and find
that the user 'bob' is not there, while been logged in as bob.
I created the group with 'groupadd pico' and added bob to the group with
'usermod -a -G pico bob' when I do 'id -Gn' I get 'bob' only, the script
is expecting 'bob' and 'pico'.
If I log in as root and do 'id -Gn bob' I get 'bob pico'
The script is just to make sure you have permission to access the
hardware before running the main program.
If the script is run as root it will id you as root and say you
have access to the hardware.
I am running FC6 and the script was written on/for FC8.
I don't think the script is at fault it just looks like bob is not
in the pico group.
Philip
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!