On Debian, there is a very similar case with cdrecord. If running a
kernel beginning with 2.0 or 2.2 then execute cdrecord.shm, otherwise,
run cdrecord.mmap.

The code used to do this is:

#!/bin/sh
VERS=`uname -r`
case "$VERS" in
  2.0.*|2.2.*)   exec cdrecord.shm "$@"
  ;;
  *)             exec cdrecord.mmap "$@"
  ;;
esac

In your case, you want to check for the UID of the user, which in case
of root = 0 but users typically are greater than 500/1000. Example:

#!/bin/sh
h=1
y=45
case "$UID" in
#      root user ... supplied arguments are used
  0)             exec <yourprogname> "$@"
  ;;
#      regular users ... default arguments are used
  *)             exec <yourprogname> $h $y
  ;;
esac


HTH,

Hendrik Schaink


Roy Souther wrote:
> I think this is beyond the ability of SUDO but I need some solution.
> 
> I need to be able to setup some way for a bash script to be run only by
> regular users without any arguments and run by root with specific
> arguments that are gathered when it is run by a regular user.
> 
> So when Joe runs the script it sees that Joe is not root and so it
> builds some arguments and sends it off to itself or another script as
> root by some system that works like sudo.
> 
> The reason I think that sudo will not work is I cannot let people run
> the sudo script directly and add their own arguments. Example; sudo
> thescript h=1 y=45. If run as a normal user it must not allow arguments
> and when run as root the only arguments that are allowed are then ones
> generated when the script ran as a normal user.
> 
> The only way I think I could make sudo work for this is if the script
> when run with sudo as root would check the parent PID to find the
> program that called it, but I think that could be faked by creating
> another script of the same name. A solution to that would be to some how
> get the inode for the current script from the /proc/$$/ files. I know
> how to do that.
> 
> So is there a better way? Is there some option I can set in the sudoers
> file to do this?
> 
> 
> Royce Souther
> www.SiliconTao.com
> Let Open Source help your business move beyond.
> 
> For security this message is digitally authenticated by GnuPG.
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> clug-talk mailing list
> [email protected]
> http://clug.ca/mailman/listinfo/clug-talk_clug.ca
> Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
> **Please remove these lines when replying

-- 
Hendrik M. Schaink
Chief Consultant

"Integrated Business Solutions & Dependable Service"

InfoVision Consulting
Calgary, Alberta, Canada
Phone: (403) 239-0099


"The Vision: We are the partners of choice for companies and
organizations that share our commitment to creating a world
that is truly wise, courageous, prosperous, innovative,
inclusive, sustainable and humane."     --Ruben Nelson

GPG Fingerprint: 1371 0927 8C3C 831F A838 C312 68BC F5DB 010D F3D7

_______________________________________________
clug-talk mailing list
[email protected]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca
Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
**Please remove these lines when replying

Reply via email to