Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To allow user switching the Agent's run-time account has to be added to the /etc/sudo.conf file.can use sudo like this:

Code Block
languagebash
titleExample for using sudo from a non-root account
linenumberstrue
sudo -su <user> <<EOF
whoami
pwd
EOF

...

  • <user> is any user account available from the operating system for which a login is performed.
  • For execution of multiline commands a Here String is used:
    • The commands between <<EOF (line 1) and EOF (line 4) are executed using su sudo.
    • Instead of EOF any unique string can be used that does not match one of the commands to be executed.
    • Using <<'EOF' will prevent substitution of environment variables in a Here String.
  • Executing su sudo from the a non-root account does not require requires to specify the sudo configuration. The location of the sudo configuration file depends on the account's password.

...

  • operating system, for example /etc/sudo.conf or /etc/sudoers.
    • Example
      • To allow the Agent run-time account to run jobs on user accounts user1, user2 the following setting can be used in the sudo configuration file.

        • <run-time-account> ALL=(user1, user2) NOPASSWD: ALL

      • To allow the Agent run-time account to run jobs on all user accounts the following setting can be used:

        • <run-time-account> ALL=(ALL) NOPASSWD: ALL

Using Script Includes

Status
colourYellow
titleTBD