LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-16-2007, 09:28 AM   #1
thepierre
LQ Newbie
 
Registered: Apr 2007
Location: The mitten shaped state
Distribution: Ubuntu 7.04
Posts: 10

Rep: Reputation: 0
This script needs to be executed as root to operate properly


I am trying to install this: linux-acu-driver-v21.tar.gz

I downloaded from Cisco.com

When I run the command sh install or ./install I get:

This script needs to be executed as root to operate properly

I switch to root:

sudo su
enter my password
and run the command again, and still get the error.

I also logged out and logged back in as root and still get the error.
What am I missing here?

Thanks.
 
Old 04-16-2007, 09:39 AM   #2
coolb
Member
 
Registered: Apr 2006
Location: Cape Town, South Africa
Distribution: Gentoo 2006.1(2.6.17-gentoo-r7)
Posts: 222

Rep: Reputation: 30
what if you do 'sh ./install.sh' ?
 
Old 04-16-2007, 10:01 AM   #3
thepierre
LQ Newbie
 
Registered: Apr 2007
Location: The mitten shaped state
Distribution: Ubuntu 7.04
Posts: 10

Original Poster
Rep: Reputation: 0
It tells me this:

Can't open ./install.sh
 
Old 04-16-2007, 10:13 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,680
Blog Entries: 14

Rep: Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022
Since it is a "script" you should be able to view its contents (vi the file or cat it). Go to the line that has the message you're seeing and look at the surrounding code to see how it is determining which user is running it.

I could understand if it failed on the su to root because some things use "real" id as opposed to "effective" id. When you su your real ID is the one you su'd from and your effective id is the on su'd to.

However I can't imagine why it would complain if you did a direct login as root because both your real and effective ids would be root.
 
Old 04-16-2007, 10:23 AM   #5
thepierre
LQ Newbie
 
Registered: Apr 2007
Location: The mitten shaped state
Distribution: Ubuntu 7.04
Posts: 10

Original Poster
Rep: Reputation: 0
Here is what the install script says:

if [ "$UID" != "0" ]
then
echo "This script needs to be executed as root to operate properly."
exit 1
fi

if [ $# -ne 0 ]
then
while getopts ":i:du:r:du:RC" Option

~~~~~~~~~~~~~~

Can I make a change to the script to make it work?
 
Old 04-16-2007, 10:40 AM   #6
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,680
Blog Entries: 14

Rep: Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022
= is for string comparisons.

It might work to change it to -ne for numeric:

Code:
if [ $UID -ne 0 ]
then
echo "This script needs to be executed as root to operate properly."
exit 1
fi
Before you start the script do "echo $UID" to verify it is in fact 0.
Make sure the script doesn't have any line that tries to set the UID value and thereby overrides your real UID. Examples:
UID=`some command`
UID=value
 
Old 04-16-2007, 10:55 AM   #7
thepierre
LQ Newbie
 
Registered: Apr 2007
Location: The mitten shaped state
Distribution: Ubuntu 7.04
Posts: 10

Original Poster
Rep: Reputation: 0
Ok, when I changed the code, I got a mountain of error messages, and that didn't work.

I checked my UID and it returned 1000

The script does not mention UID anywhere else except that one line.
 
Old 04-16-2007, 10:59 AM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,680
Blog Entries: 14

Rep: Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022
Your $UID after direct login as root is 1000? If so that is your problem.

Type "grep ^root /etc/passwd"

Verify the 3rd colon separate field is 0 rather than 1000.

If not post what distro you're using. There are some that are sudo only I think and maybe you have one of those. If so I won't be able to help because (Thank God) I don't have one - but someone else may be able to do so.
 
Old 04-16-2007, 11:06 AM   #9
thepierre
LQ Newbie
 
Registered: Apr 2007
Location: The mitten shaped state
Distribution: Ubuntu 7.04
Posts: 10

Original Poster
Rep: Reputation: 0
I changed to root, and the UID is 0.

It still gives me the error.

I am using Ubuntu 7.04
 
Old 04-16-2007, 11:47 AM   #10
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,680
Blog Entries: 14

Rep: Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022
When you say the UID is 0 do you mean "echo $UID" returned "0"? If so the original script should work. I just did a test using that syntax and it worked fine even when I did an su.

What is the very first line of the script? If it is something like:
#!/bin/bash
That is an interpreter specification line. Make sure whatever is specified after #! exists and is not SUID:
Example: ls -l /bin/bash
returns: -rwxr-xr-x 1 root root 686520 May 10 2005 /bin/bash
If you saw "rwsr-x-r-x and the file was NOT owned by root then it would be changing the shell to run as whoever the owner was even though you had logged in as root. This shouldn't be the case but is something to check.
 
Old 04-16-2007, 12:20 PM   #11
thepierre
LQ Newbie
 
Registered: Apr 2007
Location: The mitten shaped state
Distribution: Ubuntu 7.04
Posts: 10

Original Poster
Rep: Reputation: 0
Ok, I ran that command, and got this:

-rwxr-xr-x 1 root root 700560 2007-04-10 19:32 /bin/bash


I went back to cisco.com as root and re downloaded the file, and it still doesn't work, I really don't get what the problem is.
 
Old 04-16-2007, 12:59 PM   #12
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,680
Blog Entries: 14

Rep: Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022
I wasn't saying to run "ls -l /bin/bash" - I was using that as an example if "#!/bin/bash" was the first line of the script. Is it?
 
Old 04-16-2007, 01:08 PM   #13
thepierre
LQ Newbie
 
Registered: Apr 2007
Location: The mitten shaped state
Distribution: Ubuntu 7.04
Posts: 10

Original Poster
Rep: Reputation: 0
Yes it is.

Here is what I see, the first few lines of the script:

#!/bin/sh
###############################################################
# kpciinstall 2.0.1 raw 4/17/02 #
# kpciinstall 2.0.2 raw 4/17/02 Changes for RH 6.2 #
# kpciinstall 2.0.3 raw 4/17/02 Changes for user auth in wep #
# setkey functions.
# kpciinstall 2.0.4 taw 4/18/02 Fix compiler breakage #
# Script to build/install the 2.0 version PCMCIA MIC and #
# the miniPCI drivers and utilities. With -R argument #
# utilities and drivers are removed #
# install 2.0.5 4/05/03 change the world #
###############################################################

KERNEL_RELEASE=`uname -r`
SRCDIR=/usr/src/linux-`uname -r`
MODBASE="/lib/modules/`uname -r`"
SRCDIRS=`echo /usr/src/*`
ARCHDIR=`pwd`
 
Old 04-16-2007, 01:15 PM   #14
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,680
Blog Entries: 14

Rep: Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022Reputation: 1022
So the interpreter it is expecting is /bin/sh rather than /bin/bash.
Do your ls -l on /bin/sh. On most Linux distros it is a link to /bin/bash. So on FC4 for example I see:


ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jun 20 2006 /bin/sh -> bash

You'd want to check that then check whatever it pointed to. bash is the "Bourne Again SHell". The original Bourne Shell was simply "sh". There was a later Posix shell named "sh". There was also an enhanced shell called ksh (Korn Shell). Both bash and ksh as well as the posix shell have many features that weren't in the Bourne Shell so it could make a difference in how it runs the script.
 
Old 04-16-2007, 01:26 PM   #15
thepierre
LQ Newbie
 
Registered: Apr 2007
Location: The mitten shaped state
Distribution: Ubuntu 7.04
Posts: 10

Original Poster
Rep: Reputation: 0
What does dash mean??

lrwxrwxrwx 1 root root 4 2007-04-02 18:24 /bin/sh -> dash
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php files only being executed in my root directory and nowhere else :( AtomicBanana Slackware 3 03-17-2007 02:57 AM
getting gawk to operate on a string in a bash script Lordandmaker Linux - Newbie 3 02-26-2007 01:01 PM
hotplug script executed 3 times Borelian Linux - Software 1 06-29-2004 12:46 AM
No effect when 'export' command executed in a script? sylvain_gnu Linux - Software 6 04-20-2004 08:15 PM
Simple script to be executed on startup. Korff Linux - General 2 06-03-2003 10:25 PM


All times are GMT -5. The time now is 02:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration