I have a user oracle and whenever I create a new user and if required I need to grant the newly created users the sudo access on oracle.

Like as any user I need to sudo to oracle as mentioned below

$ id
uid=5260958(5258) gid=20(users) groups=600(gom)
$ sudo su -oracle

How can I allow users to have sudo access to user oracle?


As answered in server-fault

1. Updating /etc/sudoers

In /etc/sudoers the item immediately following the equals is the user that the command will be allowed to execute as.

tom  ALL=(oracle) ALL

Note: You might need to use:

tom ALL=(oracle)NOPASSWD:ALL

2. Running the command

The user (tom) can type:

sudo -u oracle bash 

or getting a shell as user oracle:

sudo -u oracle -i

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.