Linux: Add passwordless sudo permission to user
June 19, 2025 1 Comment
In this blog, I will provide passwordless sudo permission to oracle user for testing purposes. Change the username as needed.
1. As the root user, create a separate group for the purpose of granting sudo privileges. Choose a desired name for the group.
# groupadd oracle_sudoers
2. Use the usermod command to add the oracle user to the group:
# usermod -aG oracle_sudoers oracle
3. Update /etc/sudoers using visudo command
# visudo
Add the following line:
%oracle_sudoers ALL=(ALL) NOPASSWD: ALL
Explanation (read carefully):
| Part | Meaning |
|---|---|
| %oracle_sudoers | Refers to a Linux user group called oracle_sudoers. The % symbol means “group” and not a specific user. So this applies to all users who are members of this group. |
| ALL=(ALL) | Members can run commands as any user, including root. The first ALL refers to any host (typically used in multi-host sudo configs). The (ALL) means as any target user. |
| NOPASSWD: | Allows these users to run sudo commands without being prompted for a password. |
| ALL | They are allowed to run any command with sudo. You can also restrict the group to execute only the specific commands you designate in this section. |
⚠️ Security Note:
This provides full root-level access without password prompts to members of oracle_sudoers, so it should be used with caution and only for trusted administrative users (e.g., DBAs or sysadmins).