LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 08-13-2006, 07:05 PM   #1
bricedebrignaisplage
Member
 
Registered: Apr 2006
Location: singapore
Distribution: debian
Posts: 51

Rep: Reputation: 16
search path ($PATH) weird issue


I added these lines to /etc/profile

Code:
PATH=$PATH:/usr/realtime/bin
export PATH
and when I log in as a regular user the path is modified. When I log in as root too.

However, if I am logged in as a regular user and if from a terminal I log in as root (su root), the path doesn't contain /usr/realtime/bin anymore! Or if I try to call one of the scripts in /usr/realtime/bin with sudo, it's not found.

I tried to modify /root/.bash_profile but that leads to the same result.

Can anybody explain?
And then, how should I do to be able to sudo a script in that directory?
PS: I am working with Ubuntu, latest release

Thanks
Brice
 
Old 08-13-2006, 09:04 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
From memory if you just su root it's not a login shell and the stuff in /etc/profile, /etc/profile.d/* & ~/.bash_profile is not sourced. Have you tried su - root instead? That should login and use the profile info.
 
Old 08-14-2006, 09:14 PM   #3
bricedebrignaisplage
Member
 
Registered: Apr 2006
Location: singapore
Distribution: debian
Posts: 51

Original Poster
Rep: Reputation: 16
ok
with su - root the result is as expected: my path is updated.

thanks
 
Old 04-25-2007, 04:41 AM   #4
bricedebrignaisplage
Member
 
Registered: Apr 2006
Location: singapore
Distribution: debian
Posts: 51

Original Poster
Rep: Reputation: 16
and what about sudo?
Code:
$1> echo $PATH
/home/brice/bin:(...)
$2> sudo echo $PATH
/home/brice/bin:(...)
$3> which testpath
/home/brice/bin/testpath
$4> sudo which testpath
$5> sudo testpath
sudo: testpath: command not found
the path is defined in /etc/profile (for all users).

how come? and how to fix?
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP search path jmanjohn61 Linux - Software 2 01-21-2009 12:47 PM
standard search path of g++ ekdya Programming 2 07-22-2006 01:40 PM
adding to search path sefzik Linux - Software 2 01-28-2005 02:26 PM
I need to add a directory to the search path johnjafa Linux - Software 1 01-06-2005 01:43 PM
How to Chnage Python's module search path (sys.path)? lramos85 Linux - Software 1 05-02-2004 06:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:04 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
Open Source Consulting | Domain Registration