RemoteExecution does not use sudo

Problem:
Attempt to update a Host collection by selecting Package Installation, Removal, and Update > Update all packages > By remote execution

All hosts fail with “You need to be root to perform this command.” via standard output.

I have already configured the following global settings:

  • Effective User Method = sudo
  • Effective User
  • Effective user password
  • SSH User
  • Default SSH password
  • Use remote execution by default = yes

non-sudo remote commands execute successfully via Remote Execution. Issue appears to be limited to any RemoteExecution that requires escalation.

Have already confirmed user permissions are configured correctly, and the commands are successful on the client’s local console when using sudo.

Expected outcome:
Remote Execution should leverage sudo

Foreman and Proxy versions:
foreman 2.3.1
foreman_remote_execution 4.2.1
katello 3.18.0

Distribution and version:
Centos 7.9

Found my solution. I had misunderstood documentation.

I got clarity after I read the initial feature request ticket.

Previously, i had misunderstood the field definitions, and was using something like…

  • Effective User = myuser
  • SSH User = myuser

However, I now understand that it should be like…

  • Effective User = root
  • SSH User = myuser

Issue resolved now.

1 Like

Thanks for providing the solution.

If you have a better formulation that would make the documentation clearer, please open a PR against https://github.com/theforeman/theforeman.org/blob/gh-pages/plugins/foreman_remote_execution/nightly/index.md

that would be highly appreciated! Thanks again.