Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong sudo_flags used (or error in docs) #7418

Closed
hkariti opened this issue May 15, 2014 · 4 comments · Fixed by #10959
Closed

Wrong sudo_flags used (or error in docs) #7418

hkariti opened this issue May 15, 2014 · 4 comments · Fixed by #10959
Labels
docs This issue/PR relates to or includes documentation.

Comments

@hkariti
Copy link
Contributor

hkariti commented May 15, 2014

Issue Type:

Documentation Report

Ansible Version:

ansible 1.7 (ec2_hostname_variable 172fdf9e6a) last updated 2014/05/14 12:57:21 (GMT +300)

Environment:

Ubuntu 13.10

Summary:

The docs say that sudo_flags defaults to preserving the environment, but the flag actually passed is -H, which doesn't do that at all. The correct flag is -E.

Is this an error in the docs or a bug?

Steps To Reproduce:

cat docsite/rst/intro_configuration.rst | grep environment | grep preserve

man sudo | grep environment | grep preserve

Expected Results:

The two docs agree with each other.

Actual Results:

They do not.

@mpdehaan
Copy link
Contributor

It preserves the home dir, not the environment, so the docs need to be updated.

@mpdehaan mpdehaan added P3 and removed bug_report labels May 15, 2014
@hkariti
Copy link
Contributor Author

hkariti commented May 15, 2014

It actually sets the HOME variable to the destination user's homedir:

$ sudo bash -c 'echo $HOME'                                                
/home/hkariti
$ sudo -H bash -c 'echo $HOME'                                             
/root

@bcoca
Copy link
Member

bcoca commented May 15, 2014

from man page on ubuntu:
-H The -H (HOME) option requests that the security policy set
the HOME environment variable to the home directory of the target user
(root by default) as specified by the password database. Depending on the
policy, this may be the default behavior.

​so it forces resetting HOME to the user you sudo into, not preserve it
(unless I'm reading it wrong). Most machines have this as a default policy
but it is not guaranteed.

nmadhok added a commit to nmadhok/ansible that referenced this issue Sep 30, 2014
@muffl0n
Copy link
Contributor

muffl0n commented May 8, 2015

👍 for updating the docs. Took me some time to figure out that the docs are wrong.

bcoca added a commit to bcoca/ansible that referenced this issue May 8, 2015
@ansibot ansibot added docs This issue/PR relates to or includes documentation. and removed docs_report labels Mar 1, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs This issue/PR relates to or includes documentation.
Projects
None yet
5 participants