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

added becomeSetHome method to add -H flag when using sudo #1556

Merged
merged 8 commits into from
Apr 18, 2018

Conversation

gabrielef
Copy link
Contributor

I have added the becomeSetHome method to add the -H flag when become is used. In this way is possible to use home directory of the current user.

@antonmedv
Copy link
Member

Nice! But how does this implemented for example in ansible?

@antonmedv
Copy link
Member

And please update changelog.

@antonmedv antonmedv added this to the 6.1 milestone Feb 22, 2018
@gabrielef
Copy link
Contributor Author

This feature add the -H flasg to the current implementation of the become() method:
sudo -H -u <user>

In this way the ~ directory will be the /home/user directory. This could be useful because not in all systems is the default behaviour as reported in the sudo man:

-H, --set-home
Request that the security policy set the HOME environment variable to the home directory specified by the target user's password database entry. Depending on the policy, this may be the default behavior.

Ansible is doing this as a default behaviour.

@antonmedv
Copy link
Member

Maybe we can do it as default too and merge in into v7?

@gabrielef
Copy link
Contributor Author

I think it could be good as a default behaviour too.

My current workaround, using version 6.x is to declare become as below:

->become('{{become_user}} -H ')

}

/**
* @param bool $becomeSetHome
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be great to have more docs on this "setter", so people know why/when this switch will be usefull.

@antonmedv
Copy link
Member

Let's use -H by default and merge it then.

@antonmedv antonmedv merged commit 1e26eff into deployphp:master Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants