cancel
Showing results for 
Search instead for 
Did you mean: 

su - strange behaviour

Andrew Young_2
Honored Contributor

su - strange behaviour

Hi.

On my development server (ia64 hp-ux 11.31) su has suddenly started behaving quite strangely. Any scripts started with the -c option are losing the TZ environment variable. It appears that /etc/profile is not being run. Any suggestion as to what could be causing this?

In order to test this I have enabled SU_KEEP_ENV_VARS=HOME,SHLIB_PATH,TZ
in /etc/default/security but whether this is set or not seems to make no difference.

Thanks in advance.

Andrew Y
Si hoc legere scis, nimis eruditionis habes
3 REPLIES
Pete Randall
Outstanding Contributor

Re: su - strange behaviour

"su" or "su -"?


Pete

Pete
Andrew Young_2
Honored Contributor

Re: su - strange behaviour

Oops. Sorry.

su - myuser -c command

As listed below:

root@dev01[/root] #su - jss_test -c 'echo $TZ'

root@dev01[/root] #su jss_test -c 'echo $TZ'
SAST-2
root@dev01[/root] #su jss_test 'echo $TZ'
bash: echo $TZ: No such file or directory
root@dev01[/root] #su - jss_test
Bad planning on your part does not constitute a disaster on someone else's part.
/home/jss_test] echo $TZ
SAST-2
/home/jss_test] exit
logout
root@dev01[/root] #su jss_test
root@dev01[/root] #echo $TZ
SAST-2

Si hoc legere scis, nimis eruditionis habes
Pete Randall
Outstanding Contributor

Re: su - strange behaviour

I have no idea whether the bash shell is supposed to execute any profile/login scripts on login or not - have you tried this with a different shell?


Pete

Pete