Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-05-2004, 05:37 PM   #1
Registered: Mar 2004
Location: Dublin, Ireland.
Distribution: redHat 7.2
Posts: 36

Rep: Reputation: 15
Can't execute commands when logged in as ordinary user....

Hello all,
I've got a (hopefully) small problem,
I can't execute most commands when logged in as an ordinary user. I see from the echo $PATH command that the commands I'm trying to execute are not in there, specifically /sbin. If I su to root the path does not change and I still can't execute the commands in /sbin. Is there any good reason Linux has different default paths (I'm thinking security to stop ordinary users doin' stuff they shouldn't) for root and ordinary users and if so then why doesn't su'ing to root also modify the path to that of root?
It's easy for me to just add the /sbin directory to the path but is this wise?
I'm not an enterprise setup or anything and nobody but me (or a cracker) is gonna screw things up so I guess I'm just curious?

Thanks for any answers.
Old 04-05-2004, 05:51 PM   #2
Registered: Mar 2004
Location: US
Distribution: Redhat 9 - Linux 2.6.3
Posts: 836

Rep: Reputation: 31
add /sbin to your normal users path.

but some utilities you use may not be available to normal users. like ifdown.
unless you make everything open in the system.

or you could simply type the full path-to-file name like:

#/sbin/ifdown <enter>
Old 04-05-2004, 06:11 PM   #3
Senior Member
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
There is no reason to add /sbin to normal users since the commands in the /sbin directory is for single user mode, that's what the s comes from.
/sbin should contain commands necessary for single user mode and boot up situations.

The path only contains the paths to search for executables. A normal user can try to run a command like /sbin/lilo, but if he hasn't got the execute permission for the file he can't run it anyway.

When using su the login scripts of root isn't run. To run root's login scripts and thereby set the path use su -
Old 04-05-2004, 06:23 PM   #4
Registered: Mar 2004
Location: Dublin, Ireland.
Distribution: redHat 7.2
Posts: 36

Original Poster
Rep: Reputation: 15
Thanks for the replies guys,
Ugge that was exactly the information I wanted.


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Samba] Execute commands depending on user billiejoex Linux - Software 1 10-25-2005 01:01 PM
How a ordinary user can run commands having only root privilige in C? shivaligupta Programming 1 01-31-2005 05:24 AM
cannot execute some commands as an plain user! minike Slackware 5 09-03-2004 07:34 PM
how can execute some commands when a user logs out rddreamz Programming 2 05-25-2004 04:00 PM
Ordinary user can execute the "halt" command ederts Linux - Newbie 7 05-24-2001 12:18 PM > Forums > Linux Forums > Linux - General

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

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