?
Solved

UNIX PATH variable

Posted on 2011-03-12
4
Medium Priority
?
1,017 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 1900 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month8 days, 16 hours left to enroll

765 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