Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 0.10.0
-
Fix Version/s: None
-
Component/s: Chef Client
-
Labels:None
Description
Users frequently want to be able to "run a script as a user" where the script will run the same as if they logged in as that user or su'd to it. In the current implementation, only the uid (and gid, if a group is given) are changed. So there should be a login(true) option to the bash resource. It needs to do the following (at least) to emulate being the logged in user:
- clear the PATH
- determine the user's HOME from the Etc module and set $HOME to that value
- Run bash as bash -l
This should cause the correct profile and rc files to be read, making the script run in a login-like environment.
Issue Links
- is duplicated by
-
CHEF-1523
User is not set properly in execute/script resources
-
-
CHEF-2517
$HOME not set correctly
-
-
CHEF-2948
"execute" resource and more generally mixlib-shellout may fail due to lack of proper USER or HOME environment variables in subprocess
-
- relates to
-
CHEF-2417
Deploy revision resource runs as the user invoking 'chef-client'
-
I've finding this makes running RVM system wide very difficult, as a lot of the standard cookbooks need to be modified to add a login shell wrapper to certain commands. Perhaps it could be the default option: is there any reason why not?