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
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
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
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
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
-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'
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
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