Bash scripting question

listmail@rotundus.com listmail
Mon May 17 11:47:51 PDT 2004


Roger Oberholtzer wrote,
> # This should echo command line parameters (or function paramaeters if #
> placed in a shell function), one per line.
>
>
> for param in $*
> do
> 	echo $param
> done

Thanks to you and also David Bandel for the help.  I was hoping for a way
in which I could reference a particular argument by number, but I suppose
that I can accomplish the same by keeping a separate counter.

The next silly question, how to get something running w/ setuid root.

I have a little test script which has the following contents:
---
#!/bin/bash
set | grep UID
---

Anyways, the file is owned by root and I chmod'ed it a number of ways
(a+s, 4711, 4755), all of which should by my understanding make it setuid
root.  However, if I execute this script as a non-root user the script
will spit out a non-root userid.

I suppose that my question is the following: is the script actually
executing with an effective user id of root, and if so why is it spitting
out a non-root uid and euid?  Is UID only set in a login shell?

David Aikema





More information about the Linux-users mailing list