LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 04-24-2004, 10:41 PM   #1
tvn
Member
 
Registered: Mar 2004
Posts: 96

Rep: Reputation: 15
user's PATH inherited by root when su


I added a new bin dir to my $PATH in ~/.bash_profile , the user is able to find that new dir fine but when I 'su' as root, it does not find that dir. So how to make root find that dir other than add dir to ROOT/.bash_profile and use "su -" ? Thanks in advance
 
Old 04-25-2004, 12:44 AM   #2
AMMullan
Member
 
Registered: Sep 2003
Location: United Kingdom
Distribution: Ubuntu, Arch
Posts: 438

Rep: Reputation: 30
Add the following to /etc/bashrc:

PATH=$PATH:DIR

Replace DIR with the new bin dir
 
Old 04-25-2004, 03:55 AM   #3
Dead Parrot
Senior Member
 
Registered: Mar 2004
Distribution: Debian GNU/kFreeBSD
Posts: 1,597

Rep: Reputation: 46
If you use option -p with su command (su -p), you get to keep the normal user's shell environment, including $PATH. To make this automatic you can add
alias su='su -p'
into your ~/.bashrc.

To set a default $PATH for the 'super user' you can modify ENV_SUPATH in /etc/login.defs.
 
Old 04-25-2004, 04:00 AM   #4
AMMullan
Member
 
Registered: Sep 2003
Location: United Kingdom
Distribution: Ubuntu, Arch
Posts: 438

Rep: Reputation: 30
Yes but what if he has to su from another users logon? /etc/bashrc sets that bin directory for everyone that logs on...
 
Old 04-25-2004, 05:41 AM   #5
Dead Parrot
Senior Member
 
Registered: Mar 2004
Distribution: Debian GNU/kFreeBSD
Posts: 1,597

Rep: Reputation: 46
To set the same $PATH for all users you can modify /etc/profile.

Quote:
Yes but what if he has to su from another users logon? /etc/bashrc sets that bin directory for everyone that logs on...
The system-wide equivalent for ~/.bashrc is in Debian /etc/bash.bashrc.
 
Old 04-25-2004, 06:07 AM   #6
AMMullan
Member
 
Registered: Sep 2003
Location: United Kingdom
Distribution: Ubuntu, Arch
Posts: 438

Rep: Reputation: 30
Ummmm ok so you can set it in /etc/bashrc and /etc/profile? Kewl, learnt yet another thing for Linux (lol as I've been told by a good friend of mine, you never stop learning with Linux - and thats why I like it so much)

 
  


Reply



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
How to set user's root directory in SSH? nyy Linux - Software 2 08-24-2004 06:07 AM
newbie: how to monitor other user's job when in root ? sirpelidor Linux - Newbie 3 06-23-2004 02:15 PM
Changing user's passwords from the root accont Quartzophobia Linux - General 5 01-25-2004 07:27 AM
changing a regular user's password using root Pete Dogg Linux - General 2 11-28-2003 10:49 PM
Not allowed to play kjezz game on non-root user's account rdaves@earthlink.net Linux - General 3 07-13-2001 06:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:07 PM.

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