Feature: reset $HOME by using sudo -H
The command for sudo
def user(&_block)
return yield unless options[:user]
"sudo -u #{options[:user]} #{environment_string + " " unless environment_string.empty?}-- sh -c '%s'" % %Q{#{yield}}
end
is not resetting the HOME on Ubuntu unless I add the following to the sudoer file
Defaults always_set_home
Since there is no way to override from sshkit, ( using -H) , I had to set my server to have that options. It would be nice to have the options from sshkit to not preserve the HOME
This was previously discussed in #187. We'll consider a PR for this enhancement. Can you provide one?
Surely https://github.com/capistrano/sshkit#tunneling-and-other-related-ssh-themes solves this by allowing you to add a .ssh/config to the project ?
@leehambley Would be nicer not to have a config otherwise I would have to share that accross a team
But I ll take a look at making a pull request somehow
@epinault if you read the link given, you can commit an SSH config to the repo, and SSHKit will find it, if that's not working please open a bug report.
@leehambley Sorry my ignorance but how does ssh relate to sudo in this case? Sudo is ran with sudo -u which preserve HOME. How would the ssh config help? I need to be able to connect as a specific user (different from the machine use who runs my processes)
You were not clear that:
Defaults always_set_home
Was a server-side config. Please go and adopt the closed PR if you want this feature added.