0

We currently use pbrun to switch user and then run our commands.

For ex.

$ pbrun /bin/su - enterprisedb
Last login: Wed Nov 10 15:44:43 MST 2021 on pts/5
[enterprisedb@server_name ~]$ whoami
enterprisedb
[enterprisedb@server_name ~]$

Below is how my pbrun policy is defined.

[ RunAs User ]       [ Command ]
root                 /bin/su - enterprisedb

How can I script it? I want to run a command (for ex. whoami) using enterprisedb user from my current user(ADS) on that server.

  • Possible duplicate of https://stackoverflow.com/questions/1988249/how-do-i-use-su-to-execute-the-rest-of-the-bash-script-as-that-user – Laxmikant Jun 24 '22 at 10:44

0 Answers0