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

Feature: reset $HOME by using sudo -H #341

Closed
epinault opened this issue Mar 25, 2016 · 6 comments
Closed

Feature: reset $HOME by using sudo -H #341

epinault opened this issue Mar 25, 2016 · 6 comments

Comments

@epinault
Copy link

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

@mattbrictson
Copy link
Member

This was previously discussed in #187. We'll consider a PR for this enhancement. Can you provide one?

@mattbrictson mattbrictson changed the title Issue with Ubuntu 14.04 Feature: reset $HOME by using sudo -H Mar 25, 2016
@leehambley
Copy link
Member

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 ?

@epinault
Copy link
Author

@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

@leehambley
Copy link
Member

@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.

@epinault
Copy link
Author

@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)

@leehambley
Copy link
Member

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.

@epinault epinault closed this as completed Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants