Solved

UNIX PATH variable

Posted on 2011-03-12
4
1,008 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

695 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