permission script
~TraydenT~
traydent at gmail.com
Sun Oct 25 18:00:17 UTC 2009
Le 25/10/2009 18:19, Eugeneapolinary Ju a écrit :
> omg... :D thank you!! it works!! :D
>
> --- On *Sun, 10/25/09, ~TraydenT~ /<traydent at gmail.com>/* wrote:
>
>
> From: ~TraydenT~ <traydent at gmail.com>
> Subject: Re: permission script
> To: ubuntu-users at lists.ubuntu.com
> Date: Sunday, October 25, 2009, 4:47 PM
>
> Le 25/10/2009 17:42, Eugeneapolinary Ju a écrit :
> > I just wrote a little script, that will echo a message to the
> user, if
> > it doesn't have enough permission:
> >
> > $ if ! [ "$(env LC_MESSAGES=C ifconfig wlan0 down | grep -i
> denied)"
> > == "" ]; then echo "no permission"; fi
> > SIOCSIFFLAGS: Permission denied
> > $ sudo su
> > [sudo] password for USER:
> > # if ! [ "$(env LC_MESSAGES=C ifconfig wlan0 down | grep -i
> denied)"
> > == "" ]; then echo "no permission"; fi
> > #
> >
> > but it won't works
> >
> > why?
> >
> >
> The ifconfig command returns the denied message on the standard
> error,
> not on stdout. To find if it was denied, you way redirect stderr on
> stdout (by adding 2>&1 to the command line ), or check the return
> code
> of the ifconfig command.
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> </mc/compose?to=ubuntu-users at lists.ubuntu.com>
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
>
For information, which solution did you use ? And BTW, you can check the
UID variable to determine if the person launching the script is root or not.
PS : it is preferrable to post in text (no HTML), and to reply under the
original message.
More informations here :
http://www.ubuntu.com/support/community/mailinglists/etiquette
More information about the ubuntu-users
mailing list