- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Environment variable of one particular user when r...
Operating System - HP-UX
1753814
Members
8224
Online
108805
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2008 07:07 AM
тАО09-12-2008 07:07 AM
Environment variable of one particular user when root !
Hi again (sorry)
I'm root and I need to get the value of a particular environment variable for my user test.
A complex way is to retrieve it by the command below:
grep -i MYVAR /home/test/.profile
and use some substring extraction !
Is there another way ?
Regards
Den
I'm root and I need to get the value of a particular environment variable for my user test.
A complex way is to retrieve it by the command below:
grep -i MYVAR /home/test/.profile
and use some substring extraction !
Is there another way ?
Regards
Den
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2008 07:30 AM
тАО09-12-2008 07:30 AM
Re: Environment variable of one particular user when root !
As root you can become the user with the su command and then test for the variable:
su - username (note the space between the - and username - this causes the user's environment to be set up by login)
env |grep -i MYVAR
This accomplishes the same thing but is probably a more thorough test then just checking .profile. MYVAR could be set somewhere else other than just .profile.
Pete
Pete
su - username (note the space between the - and username - this causes the user's environment to be set up by login)
env |grep -i MYVAR
This accomplishes the same thing but is probably a more thorough test then just checking .profile. MYVAR could be set somewhere else other than just .profile.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2008 07:32 AM
тАО09-12-2008 07:32 AM
Re: Environment variable of one particular user when root !
> Is there another way ?
Depending on exactly what you mean, I know of
no good way. Looking at a user's shell
start-up script may tell you what the value
of one of his environment variables is, but
what stops him from changing it manually?
And how will looking at his ".profile" tell
you what he's typed?
Why "-i" with grep? Aren't shell variables
case-sensitive?
Is there some actual problem which you are
trying to solve?
Depending on exactly what you mean, I know of
no good way. Looking at a user's shell
start-up script may tell you what the value
of one of his environment variables is, but
what stops him from changing it manually?
And how will looking at his ".profile" tell
you what he's typed?
Why "-i" with grep? Aren't shell variables
case-sensitive?
Is there some actual problem which you are
trying to solve?
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP