Solved

UNIX PATH variable

Posted on 2011-03-12
4
968 Views
Last Modified: 2012-05-11
I set my PATH variables in .profile file and also in .kshrc file.
If .profle file I set up shell variables:
----------
ENV=$HOME/.kshrc
export ENV
----------
I have set PATH variables and aliases in the .kshrc variable.
Now when I become root via pbrun ksh command and lose all the PATH variables and aliases that I had in my login.
How can I use the those when I become root?
I am on a Solaris 10 server.
0
Comment
Question by:toooki
4 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 35120094
put the PATH and other variables settings in /.profile for root user. You need to export them as well to be set in sub shells
0
 
LVL 3

Expert Comment

by:Alberto Cortes
ID: 35121709
Solution:

1. Edit /.profile
  # vi /.profile
2. Append below items to the end of /.profile:
  ENV=$HOME/.kshrc
  export ENV
3. Save and exit
0
 
LVL 6

Accepted Solution

by:
Tomunique earned 475 total points
ID: 35122097
don't know pbrun, or solaris...

but, (while not nice pretty and automated), you can manually set them.

Your Home:  /home/myhome
kshrc:        /home/myhome/.kshrc

when you log in as root
source those files with "dot space"

# .  /home/myhome/.kshrc

this will load into your crrent environment, the contents of your .kshrc file.
you could do the same thing with your .profile

# . /home/myhome/.profile

I'd urge you to NOT modify root's profile etc, to reference a users files.
WHile it can be done, IMHO, keep root as stripped down as possible.
Any problems with your .kshrc or .profile, that would prevent root from logging in, could be a bad thing in the future.

Tom
0
 

Author Comment

by:toooki
ID: 35122483
Thank you all.

Yes root user does not have any .profile or .kshrc entries -- as multiple users become root from time to time.

After being root I used the command .  /home/myhome/.kshrc and it worked perfectly.
Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Fine Tune your automatic Updates for Ubuntu / Debian
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now