Create a new opc user with elevated privileges on Oracle Linux 8.x
2 min readSep 21, 2023
There are two ways to create a new user (say “opc” ) and add sudo permissions to it:
Option 1 :
[oracle@linux ~]$ su
Password:
[root@linux home]# useradd opc
[root@linux home]# passwd opc
Changing password for user opc.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@linux home]# visudo
// Add the following entry : (To allow a user to run all commands without a password)
opc ALL=(ALL) NOPASSWD: ALL
Modified /etc/sudoers file :
Option 2:
[oracle@linux ~]$ su
Password:
[root@linux home]# useradd opc
[root@linux home]# passwd opc
Changing password for user opc.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@linux home]# usermod -aG wheel opc
[root@linux home]# visudo
// uncomment the following line : (To allow a user to run all commands without a password)
%wheel ALL=(ALL) NOPASSWD: ALL
Modified /etc/sudoers file :