LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Permissions

[ILUG] Permissions

Christian Koerner ck at ps-xaf.de
Tue Apr 29 23:32:33 IST 2008


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



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell