HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- initialize with a user different from root
Operating System - HP-UX
1834789
Members
2512
Online
110070
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
Forums
Discussions
Discussions
Discussions
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
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
03-05-2003 12:32 PM
03-05-2003 12:32 PM
Hello all,
I need help !!!
I created new script in /sbin/init.d to be started while the server is brought up .
I created links in sbin/rc2.d /sbin/rc3.d for kill and start the script/daemon
The problem is that I need this specific daemon to be initialize with a user different from root here is what I wrote
BTW if I remove the su - -c (change user command)
The script work just fine and initialize the daemon with the root user
if [ -x /opt/xxx/xxx/ -a -r /opt/xxx/xxx/ ]
then
APPD=su - -c "/opt/xxx/xxx// -f "
fi
what is wrong with this line ?
Thank you ,
A.K
I need help !!!
I created new script in /sbin/init.d to be started while the server is brought up .
I created links in sbin/rc2.d /sbin/rc3.d for kill and start the script/daemon
The problem is that I need this specific daemon to be initialize with a user different from root here is what I wrote
BTW if I remove the su -
The script work just fine and initialize the daemon with the root user
if [ -x /opt/xxx/xxx/
then
APPD=su -
fi
what is wrong with this line ?
Thank you ,
A.K
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2003 12:37 PM
03-05-2003 12:37 PM
Solution
You are trying to assign the output of your su -... command to APPD. It needs to be put in execution quotes either back ticks ` (with ~ key) or with in $(). Like
APPD=$(su -")
-Sri
APPD=$(su -
-Sri
You may be disappointed if you fail, but you are doomed if you don't try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2003 12:39 PM
03-05-2003 12:39 PM
Re: initialize with a user different from root
The problem is that you are doing a su - my_user rather than a su my_user. I know that you want to invoke my_user's .profile BUT that is your problem. The .profile contains commands like tset, stty, and tabs that expect an interactive environment - which you ain't.
The best solution is to create a script e.g. /usr/local/bin/my_user_env.sh (that contains no exit or return statements). This script will set all the environment vars and then this script is sourced (via . /usr/local/bin/my_user_env.sh) by BOTH your init.d command AND my_user's .profile.
The less good way is to surround all the interactive commands in .profile with
if [ -t 0 ]
then
tset
stty ..
fi
The best solution is to create a script e.g. /usr/local/bin/my_user_env.sh (that contains no exit or return statements). This script will set all the environment vars and then this script is sourced (via . /usr/local/bin/my_user_env.sh) by BOTH your init.d command AND my_user's .profile.
The less good way is to surround all the interactive commands in .profile with
if [ -t 0 ]
then
tset
stty ..
fi
If it ain't broke, I can fix that.
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.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP