Run a Rundeck Command as a Different User

TL;DR: Add the rundeck user to the sudoers and then use sudo

Installing rundeck on Ubuntu usually results in creating a rundeck user. We had a bunch of issues creating a rundeck job because we needed to execute a command as a specific user (only that user had access to some resources). Unfortunately, rundeck is not as versatile as Jenkins (plugins and such) — or I couldn’t find anything relevant at the time.

Initially, I’ve tried adding the rundeck user to the same group as the other user, but only with limited success. So, in order to make things clear, I’ve decided to add the rundeck user to the list of users capable of executing the sudo command:

You can go a step further and make the sudo -u myuser run a command without password.

Then, I could run a command as the other user:

Here, whoami would give me rundeck and the last command would execute nicely as the desired user.


A little experiment: If you find this post and ad below useful, please check the ad out :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top