How to setup Remote Execution using non-root users with password?
Environment
- Red Hat Satellite 6
- Remote Execution
Issue
- How to setup Remote Execution using a non-root user with password on RHEL system connected to Red Hat Satellite 6?
Resolution
- On the client machine create a user with a password set and add it to the sudoers.
[root@client ~]# useradd -m Remoteuser
[root@client ~]# passwd Remoteuser
Changing password for user Remoteuser.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@client ~]# echo "Remoteuser ALL=(ALL) ALL" > /etc/sudoers.d/Remoteuser
- Verify if
RemoteUsercan execute thesudocommands with the password.
[root@client ~]# su - Remoteuser
[Remoteuser@client ~]# sudo fdisk -l
-
If
RemoteUseruser can execute commands without any issues, then Configure the "Global setting for Remote Execution" by making the following changes in the Satellite WebUI.Log in to Satellite WebUI -> Click on Administer -> Click on Settings -> Click on the RemoteExecution tab -
Set the following parameter:-
SSH User: Remote user Default SSH password: Password for the Remoteuser Effective User Method: sudo Effective User: root Effective User password: Password for the Remoteuser when running sudo
Note: Set Effective User to root user, as it will connect to the remote host as RemoteUser. Run sudo to change the user to Effective User and then run the job as that user.
- Now Remote Execution jobs can be scheduled using a non-root user. If you dont want to provide Default SSH password, let distribute SSH keys to the client system:
ssh-copy-id -i ~foreman-proxy/.ssh/id_rsa_foreman_proxy.pub Remoteuser@HOST.FQDN
If you dont want to provide Effective User password for sudo, please follow this solution for more aligned sudoers configuration.
- The steps to execute a remote job in Red Hat Satellite 6.9 are outlined in section 10. Configuring and Setting up Remote Jobs
For more KB articles/solutions related to Red Hat Satellite 6.x Remote Execution Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Remote Execution Issues
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.