[sudo-users] env_file and using variables

Simon Fraser srf at sanger.ac.uk
Mon Mar 7 09:30:57 EST 2011


I'm just trying out the env_file directive for the first time. I'd like
to be able to use $SUDO_USER in one of the variables set in this file,
since I can't guarantee that the target user's environment will be read.

Specifically, I want to include $SUDO_USER in the HISTFILE variable.
However, entries in this file are applied literally, so the HISTFILE
variable ends up containing '.bash_history.$SUDO_USER'.  I've tried
variations with no quotes, single and double quotes, and with 'export'
and without. 

Is there a good way of setting this dynamically, or is it a lost cause
unless the target user's bashrc is used? 


 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

More information about the sudo-users mailing list