Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Getting SU to have the Same $PATH as Root
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
elboricua
Apprentice
Apprentice


Joined: 17 May 2002
Posts: 226
Location: Bronx, NY

PostPosted: Sun Jun 16, 2002 8:11 pm    Post subject: Getting SU to have the Same $PATH as Root Reply with quote

Hello all. I am trying to get su to have the same $PATH as root. Right now if I log in as root, I can get to commands like shutdown, kdm etc. If I login as a user and then su to root and I try command I get an error bash shutdown not found.

I copied everything in root to /etc/skel and I created a new user who was a member of the wheel group. Well now the user has th right path. If I try shutdown (of course I get the you must be root to do that mesage). If I su after that and try shutdown -r now I get that same bash shutdown not found.

Any ideas on how to get su to have the same $path as root? As an interim solution I made a copy of roots $PATH and when I su I have a mini script that I made that basically does export $PATH=:/same/as/what/root/has

Is there a way to do this without having to do the extra step of adding export $PATH ? I have tried adding export $PATH into the users .bashrc and it does not work when I su. I am stumped.
_________________
Boricua Hasta La Muerte
Back to top
View user's profile Send private message
rogue
Tux's lil' helper
Tux's lil' helper


Joined: 15 May 2002
Posts: 99
Location: Falls Church, VA

PostPosted: Sun Jun 16, 2002 8:34 pm    Post subject: Reply with quote

just do the command 'su -'

the - means the user you are changing to, in thsi case root, has it's environment take over the shell.
_________________
(rob)
Back to top
View user's profile Send private message
elboricua
Apprentice
Apprentice


Joined: 17 May 2002
Posts: 226
Location: Bronx, NY

PostPosted: Sun Jun 16, 2002 8:49 pm    Post subject: Reply with quote

Cool tip thank you!! I put

alias su='/bin/su -'

into my .bashrc file
_________________
Boricua Hasta La Muerte
Back to top
View user's profile Send private message
BoBB
Tux's lil' helper
Tux's lil' helper


Joined: 15 Jun 2002
Posts: 143
Location: Mesa, AZ

PostPosted: Sun Jun 16, 2002 11:48 pm    Post subject: Reply with quote

is there a way to have 'su-' not go to roots home directory? when i used debian su would stay in working directory and have roots PATH and i kinda got used to it. Is there a way to do that?
Back to top
View user's profile Send private message
stixx
n00b
n00b


Joined: 17 Jun 2002
Posts: 3

PostPosted: Mon Jun 17, 2002 12:25 pm    Post subject: Reply with quote

The point of using su - <user> is that you receive the entire environment of that user you are becoming. If you dont want to change to the other home directory just use su then source ~<user>/.profile or .bash_profile or whatever shell they are using :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum