- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sudo environment settings
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-20-2005 06:27 PM
09-20-2005 06:27 PM
sudo environment settings
I have given sudo permission to a user to restart apache. The user is able to restart apache server but want to set the environment variable before restarting apache.
Is it possible to set the user profile so that when he run 'sudo' command the parameters remain set?
The parameter he need are :
export LD_PRELOAD=/usr/lib/lib123
export SHLIB_PATH=/usr:/usr/lib:/opt/abc/bin:/opt/abc/bin/lib/ext:/opt/abc/cgi-bin
export AB_LIBRARY_PATH=/opt/abc/cgi-bin
export ABC_DEFG_DIR=/opt/abc/cgi-bin
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2005 06:33 PM
09-20-2005 06:33 PM
Re: sudo environment settings
gi-bin;export ABC_DEFG_DIR=/opt/abc/cgi-bin;apachectl start"
Will also work. You can also put required things in one file and last statement in this file to start apache.
host_name (user_name) "one_big_script"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2005 06:44 PM
09-20-2005 06:44 PM
Re: sudo environment settings
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2005 01:11 AM
09-22-2005 01:11 AM
Re: sudo environment settings
sudo su -
By doing the above he would get all environment variables that user normally gets.
Of course you would NOT want to set it up to allow him to do "sudo su - root" (or just "su -" which is the same thing).
Alternatively you could create a wrapper script that sets the above variables then executes the command and give him sudo access to execute that script. If you do that make sure the wrapper script is only editable by root so that no one puts a back door in it by adding an "su - " statement to it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2005 02:09 AM
09-22-2005 02:09 AM
Re: sudo environment settings
It seems you can put these commands ,
export LD_PRELOAD=/usr/lib/lib123
export SHLIB_PATH=/usr:/usr/lib:/opt/abc/bin:/opt/abc/bin/lib/ext:/opt/abc/cgi-bin
export AB_LIBRARY_PATH=/opt/abc/cgi-bin
export ABC_DEFG_DIR=/opt/abc/cgi-bin
in .profile of the user .
So when they will run sudo command it will be remain same,
You have to give the permission for running apache commands in /usr/local/etc/sudo/sudoers file.
Once the user .profile executed ..
the command would be look like that...and can start the apache web server:
$ /usr/locla/bin/sudo apache start
hth,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2005 12:59 AM
09-26-2005 12:59 AM
Re: sudo environment settings
from the manpage;
Variables that control how dynamic loading and binding is done can be used to subvert the program that sudo runs. To combat this the LD_*, _RLD_*, SHLIB_PATH (HP-UX only), and LIBPATH (AIX only) environment variables are removed from the environment passed on to all commands executed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2007 06:44 PM
01-15-2007 06:44 PM
Re: sudo environment settings
I agree with RAC,
U make a script to start apache as root, set all
env. in this script, and give access to this
script in /etc/sudoers to that user.
This will make /etc/sudoers simple and this is
more secure also.
-Santosh