Solved

UNIX PATH variable

Posted on 2011-03-12
4
994 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
000webhost.com default error log 1 61
python - find anything after $ question. 9 52
Linux 3 38
SMTP log file for IMSVA 5 35
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…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

730 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