- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: SUDO in
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
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
12-29-2007 02:30 PM
12-29-2007 02:30 PM
Re: SUDO in
> My objectinve is to execute /usr/sap/PRD/SYS/exe/run/startsap script as prdadm user (with the environment vairiables of prdadm) from an ordinary user.
Sourcing another user's profile in order to populate your environment with that user's variables is a poor choice. A cleaner approach is to define environmental variables that you want to propagate to an interactive shell login as well as to any script or non-interactive process in a file by themselves. Then, source (read) that file not only in the user login profile but whenever you need the variables.
# cat /path/myenv
#!/usr/bin/sh
export NAME=me
export THING=it
In the login profile and/or in any script so requiring these variables, do:
. /path/myenv
Note that the syntax is a dot ('.') followed by a blank (space), followed by the name of the file to be sourced.
This also allows you to create subshells containing the variables only when you need them:
# ( . /path/myenv; echo "I am ${NAME}"; )
I am me
# echo "I am ${NAME}"
sh: NAME: Parameter not set.
Hence the flexability and power of your environmental variables is increased by isolating their declaration in a file separate from a login profile.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2007 09:53 PM
12-29-2007 09:53 PM
Re: SUDO in
>it doesn't connect to prdadm.
Of course it fails, you still need that -u.
Looking closely at that sudo man page may imply you can't use -i and a command? If so, you'll need to use a here document:
sudo -u prdadm -i <
EOF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2008 12:32 PM
01-02-2008 12:32 PM
Re: SUDO in
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2008 12:55 AM
01-03-2008 12:55 AM
Re: SUDO in
You have more unassigned questions you can add points to. :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2008 01:04 PM
01-16-2008 01:04 PM
Re: SUDO in
Defaults@SAP log_year, logfile=/backup/sudoaudit/mysudo.log
- « Previous
-
- 1
- 2
- Next »