Sei sulla pagina 1di 2

Sudo user for resetting root password

Installation:

mkdir /amit
cd /amit
bash-2.05# mkdir /export/home/labadmin
bash-2.05# useradd -o -u100 -g3 -d/export/home/labadmin -s/bin/bash -c "Lab
Administrator" labadmin #created user ‘labadmin’ group=3 means
into ‘sys’ group’ [since ‘/etc/passwd’ belongs to ‘sys’ group]
bash-2.05# passwd labadmin
New Password:
Re-enter new Password:
passwd: password successfully changed for labadmin
bash-2.05#
bash-2.05# pwd
/amit
bash-2.05# ls
gcc-3.4.6-sol9-sparc-local.gz libintl-3.4.0-sol9-sparc-local.gz #
copied required files
libgcc-3.4.6-sol9-sparc-local.gz sudo-1.6.9p16-sol9-sparc-local.gz
libiconv-1.11-sol9-sparc-local.gz
bash-2.05#
bash-2.05#
bash-2.05# gunzip gcc-3.4.6-sol9-sparc-local.gz
bash-2.05# gunzip libintl-3.4.0-sol9-sparc-local.gz
bash-2.05# gunzip libgcc-3.4.6-sol9-sparc-local.gz
bash-2.05# gunzip sudo-1.6.9p16-sol9-sparc-local.gz
bash-2.05# gunzip libiconv-1.11-sol9-sparc-local.gz

bash-2.05#
bash-2.05#
bash-2.05# ls
gcc-3.4.6-sol9-sparc-local libintl-3.4.0-sol9-sparc-local
libgcc-3.4.6-sol9-sparc-local sudo-1.6.9p16-sol9-sparc-local
libiconv-1.11-sol9-sparc-local
bash-2.05#
bash-2.05# # installed
it by pkgadd command
106 pkgadd -d /amit/gcc-3.4.6-sol9-sparc-local
107 pkgadd -d /amit/libintl-3.4.0-sol9-sparc-local
108 pkgadd -d /amit/libgcc-3.4.6-sol9-sparc-local
109 pkgadd -d /amit/libiconv-1.11-sol9-sparc-local
110 pkgadd -d /amit/sudo-1.6.9p16-sol9-sparc-local
111 history

Configuration:

bash-2.05#
bash-2.05# PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/ccs/bin #set
Path as shown otherwise we have to fire commands with full path
/usr/local/sbin/visudo
bash-2.05# passwd labadmin
New Password:
Re-enter new Password:
passwd: password successfully changed for labadmin
bash-2.05# visudo

# User privilege specification


root ALL=(ALL) ALL

labadmin ALL=(ALL) ALL # labadmin


can do everything as ‘root’ will do.

labadmin ALL= /usr/bin/vi /etc/passwd # will able to


edit [by using ‘vi’ ] file /etc/passwd.

The installation and configuration part is over here. Login through labadmin,

login: labadmin
Password:
Login incorrect
login: labadmin
Password:
Sun Microsystems Inc. SunOS 5.9 Generic May 2002
bash-2.05$ sudo password root
bash: sudo: command not found
bash-2.05$ PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/ccs/bin
bash-2.05$ sudo passwd root

We trust you have received the usual lecture from the local System # this
is the o/p we get very 1st time when we fire ‘sudo password root’
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.


#2) Think before you type.
#3) With great power comes great responsibility.

Password: # in here
you have to give ‘labadmin’ password once
New Password: #password
you want to set for ‘root’
Re-enter new Password: #re-enter
password you want to set for ‘root’
passwd: password successfully changed for root
bash-2.05$

Then after words its does not ask about ‘labadmin’ password.

Regards,
Amit Sapre

Potrebbero piacerti anche