- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: su from root to user account does not execute ...
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-13-2005 09:13 AM
09-13-2005 09:13 AM
su from root to user account does not execute .profile and set up env
I am running the following command:
su appuser -c "/home/appusers/script.sh /home/appuser"
Where appuser is the username and the script is script.sh located in the home directory and needs to have the argument of the location afterwards. If I login as the user the .profile sets up all the environmental variables and the script runs fine, but if I run it as root through that command it does not run because its environment is not set up correctly.
I don't think any special options need to get passed to su to run the .profile and set up the environment. I'm only having and issue on one single server. It runs fine on the others. I thought there might be some security setting somewhere preventing it but I checked /etc/default/security and they match up fine. Any ideas? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 09:19 AM
09-13-2005 09:19 AM
Re: su from root to user account does not execute .profile and set up env
su - username
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 09:21 AM
09-13-2005 09:21 AM
Re: su from root to user account does not execute .profile and set up env
su - newuser
With the hyphen you get the newuser env.
Without the hyphen you do not get the env
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 09:25 AM
09-13-2005 09:25 AM
Re: su from root to user account does not execute .profile and set up env
You can try the following ..
su appuser -c "/home/appusers/script.sh /home/appuser"
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 09:26 AM
09-13-2005 09:26 AM
Re: su from root to user account does not execute .profile and set up env
# su - appuser -c "/home/appusers/script.sh /home/appuser"
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 03:18 PM
09-13-2005 03:18 PM
Re: su from root to user account does not execute .profile and set up env
-yut-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 04:03 PM
09-13-2005 04:03 PM
Re: su from root to user account does not execute .profile and set up env
Become user test but change the environment to what would be expected if bin had originally logged in:#su - test
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 06:26 PM
09-13-2005 06:26 PM
Re: su from root to user account does not execute .profile and set up env
- If the - option is specified, the new shell starts up as if the new user had initiated a new login session. If the - option is omitted, the new shell starts as if a subshell was invoked.
Since login shells execute .profile you need to use - to make the new shell a login shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2005 07:43 PM
09-13-2005 07:43 PM
Re: su from root to user account does not execute .profile and set up env
You can feel this as,
When we are executing su - appuser -c "command" from root user then, it will use new user's environment settings.
hth.