Re: [opensuse] Quick Bash Q - How to test for root when under 'su'

2007-10-30 Thread David C. Rankin
Cristea Bogdan wrote: > Here is the piece of code I have used: > > ROOT_UID=0 # Only users with $UID 0 have root privileges. > E_NOTROOT=67 # Non-root exit error. > if [ "$UID" -ne "$ROOT_UID" ]; then > echo "Must be root to run this script." > exit $E_NOTROOT > fi > > There is a forum ab

Re: [opensuse] Quick Bash Q - How to test for root when under 'su'

2007-10-30 Thread Stefan Hundhammer
On Tuesday 30 October 2007 17:15, Jan Engelhardt wrote: > There is no guarantee that "root" or UID 0 actually have the privilege > to do this or that. Think Linux Security Modules (LSM).. No, but that also wasn't the question here. For the ultimate check, there is little you can do other than try

Re: [opensuse] Quick Bash Q - How to test for root when under 'su'

2007-10-30 Thread Jan Engelhardt
On Oct 30 2007 17:13, Stefan Hundhammer wrote: >On Tuesday 30 October 2007 14:14, David C. Rankin J.D. P.E. wrote: >> Listmates, >> >> In a script, I need to test that the user is either root or has su'ed >> to root before continuing. The USER in the environment remains the >> original user a

Re: [opensuse] Quick Bash Q - How to test for root when under 'su'

2007-10-30 Thread Stefan Hundhammer
On Tuesday 30 October 2007 14:14, David C. Rankin J.D. P.E. wrote: > Listmates, > > In a script, I need to test that the user is either root or has su'ed > to root before continuing. The USER in the environment remains the > original user and there is nothing set related to 'su'. Any thoughts

Re: [opensuse] Quick Bash Q - How to test for root when under 'su'

2007-10-30 Thread Cristea Bogdan
Here is the piece of code I have used: ROOT_UID=0 # Only users with $UID 0 have root privileges. E_NOTROOT=67 # Non-root exit error. if [ "$UID" -ne "$ROOT_UID" ]; then echo "Must be root to run this script." exit $E_NOTROOT fi There is a forum about bash scripting: http://bashscripts.org

Re: [opensuse] Quick Bash Q - How to test for root when under 'su'

2007-10-30 Thread G T Smith
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David C. Rankin J.D. P.E. wrote: > Listmates, > > In a script, I need to test that the user is either root or has su'ed > to root before continuing. The USER in the environment remains the > original user and there is nothing set related to 'su'

Re: [opensuse] Quick Bash Q - How to test for root when under 'su'

2007-10-30 Thread Anders Johansson
On Tuesday 30 October 2007 14:14:54 David C. Rankin J.D. P.E. wrote: > Listmates, > > In a script, I need to test that the user is either root or has su'ed > to root before continuing. The USER in the environment remains the > original user and there is nothing set related to 'su'. Any though

[opensuse] Quick Bash Q - How to test for root when under 'su'

2007-10-30 Thread David C. Rankin J.D. P.E.
Listmates, In a script, I need to test that the user is either root or has su'ed to root before continuing. The USER in the environment remains the original user and there is nothing set related to 'su'. Any thoughts? -- David C. Rankin, J.D., P.E. Rankin Law Firm, PLLC 510 Ochiltree Str