- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: invoking a different .profile from command lin...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
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
Community
Resources
Forums
Blogs
- 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-26-2002 11:46 AM
09-26-2002 11:46 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 11:50 AM
09-26-2002 11:50 AM
Re: invoking a different .profile from command line or script
It doesn't run? Or the vars aren't set? etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 11:52 AM
09-26-2002 11:52 AM
Re: invoking a different .profile from command line or script
. /path/to/.profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 11:52 AM
09-26-2002 11:52 AM
Re: invoking a different .profile from command line or script
You can simply dot in the users profile as root:
. /home/users/somebody/.profile
This will pickup the environment for that user. Probably not the safest and most secure thing to do. You can also use 'su -' to pick up the environment of the user:
su - somebody -c '/usr/bin/dosomething'
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 12:10 PM
09-26-2002 12:10 PM
Re: invoking a different .profile from command line or script
The dot_blank_filename syntax already provided is known as "sourcing" the
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2002 12:18 PM
09-26-2002 12:18 PM
Solution. /path/to/.profile
I would consider this to be a BIG security problem. The user could then edit the .profile and add any shell code they wanted to run as root and the next time you run your script or that cronjob kicks off... you just gave root access to your system by this user.
I would suggest using the "su - somebody -c '/usr/bin/dosomething'" method that John suggested.
-OR-
Create your own file with the environment variables you need setup that you can source when you need it. At least this way only root can edit the file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2002 09:07 AM
09-30-2002 09:07 AM
Re: invoking a different .profile from command line or script
This is slightly off-topic, but you may give it some thought.
When working as an administrator, I've become accustomed to grouping common application profiles in an /env/ directory. The specific profiles are owned by root and readable by anyone, and the user profiles then 'source' /env/.oracle or /env/.openview, or whatever.
It makes it easier to migrate - say, part of the userbase to a new oracle release, and there's less of an administration hassle, in the end....
-rg-