You are not logged in.
Pages: 1
During the initialization of my system, I have written a script (loaded in the modules section of rc.conf) that starts up an application. I want to run this application as a specific user. So in my startup script I issue:
su - username -c "start command"
When I user other distros and the man pages say that when I use the form "su -" that the current environment should be passed to the new shell (with a modification to the path). However, after a bit of fidling around I have determined that none of the enviroment is passed.
Before I issue the su command, I export several variables that the program looks for in order to run. These are not being copied to the new shell.
Is there a way to have a su'ed shell to have the same enviornment as it's "parent"? Any other ideas on how to start to application as another user (non-root)?
Thanks for your help,
Chris....
Offline
it seems you confused the terms ;-) ... you actually have to use su without the "-" ...
With environment the docs mean the user environemnt of the user you are su-ing to. I.e. if you do
su - user
you will get the environment of user as if he logged in - everything else wiped. With
su user
you will only become user keeping the current environment.
Offline
doh! thanks for the help.
Chris....
Offline
Pages: 1