Creating sudo user for root
This is useful if you forget the root password. Password of root user can be changed using this sudo user
Creating one user called raj
# Defaults
specification
Now changing the password of oracle using the sudo user
#
useradd raj
#
passwd raj
#visudo ( to edit the file /etc/sudoers just type this and give enter , then
automatically opens the same)
#visudo -- this opens the sudoers file , the contents are shown below
# sudoers
file.
#
# This file
MUST be edited with the 'visudo' command as root.
#
# See the
sudoers man page for the details on how to write a sudoers file.
#
# Host alias
specification
# User alias
specification
# Cmnd alias
specification
# User
privilege specification
root ALL=(ALL) ALL
#oracle ALL=(ALL) ALL
raj ALL=(ALL) /usr/bin/passwd --- >
added this line
oracle ALL=(ALL) /bin/tar, /dev/st0
# Uncomment
to allow people in group wheel to run all commands
#
%wheel ALL=(ALL) ALL
# Same thing
without a password
#
%wheel ALL=(ALL) NOPASSWD: ALL
# Samples
#
%users ALL=/sbin/mount
/cdrom,/sbin/umount /cdrom
#
%users localhost=/sbin/shutdown -h now
Note :- do
not use #vi /etc/sudoers
# su -
raj
$ sudo
passwd oracle
Password:
(enter password for raj )
Changing
password for user oracle.
New UNIX
password: