LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-01-2009, 01:34 PM   #1
bigmac18
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Rep: Reputation: 0
Wrong root password


I inadvertadly changed my root password on my SunBlade100 test computer. Is there any way I can figure it out without having to reconfigure the whole OS.

Last edited by bigmac18; 03-01-2009 at 01:37 PM.
 
Old 03-01-2009, 01:38 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Do you have physical access? What is the filesystem. If you have a Solaris live version, you could mount the root partition and zero out the password, or change it to the same as your regular users entry in /etc/shadow. (:Second field. If the filesystem is mountable by a Linux live distro, you could edit /etc/shadow that way.

( I'm assuming that solaris uses shadowed passwords. )
 
Old 03-01-2009, 01:44 PM   #3
bigmac18
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Original Poster
Rep: Reputation: 0
I'm very new to this. Can you tell me a step by step way to go about it.
 
Old 03-01-2009, 02:27 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
First, do you know off hand what filesystem is used? If it is Solaris's zfs, then you need a live distro or rescue disk for Solaris.

When you run off a live distro or rescue disk, the root filesystem exists in memory. Look at the output of the "mount" command by itself to see if the hard disk partitons are mounted. If not, you will want to mount the root partition somewhere such as mount. There are a lot of ifs here, such as whether the kernel your live distro or rescue disk uses is able to mount the partition rw.

Solaris will use different device names for partitions. There are in /dev/ and probably end in p1 for the first partition, p2 for the second, etc. If your disk has the fdisk program (I don't know if solaris has its own version of this program), running "fdisk -l" will list the partitions.

You need to use the mount command to mount the partition that has the /etc directory. It should be on the root partition. I can't see anyone wanting to mount it anywhere else.

Look at the /etc/passwd file. If there is a line like: "root:x:0:0:root:/root:/bin/bash" with the second field of "x", then the system uses shadow passwords. The password hash is in /etc/shadow. Otherwise, you may see a lot of random characters between the first and second colons.

Look at the /etc/shadow file at the entry starting with "root":
root:$2a$13$gf4PslessRtZJ33IgSq33eKyS33TYJES3dPEz57dCLp556Qpabde3:14087::::::

Delete the characters between the two colons to zero the root password. This means you can reboot and login as root with no password. Then run "passwd" as root to change the root password.

I have a system that doesn't allow a null password for root. So I couldn't log in after zeroing out the password hash in /etc/shadow. So I copied the hash from my regular users entry and copied it for root's. That allowed me to log in as root using my regular user's password and then I ran "passwd" to change it.
 
Old 03-02-2009, 02:39 AM   #5
bigmac18
LQ Newbie
 
Registered: Feb 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks jschiwal I figured it out! It was well explained.
 
Old 03-02-2009, 02:52 AM   #6
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
Erm... I would have suggested trying single user mode first. If it doesn't need root password what most of the time is the case then you can just do "passwd root" in single user mode and reset the root password. I am fairly certain single user mode is possible in Solaris but am not certain of the method to do this.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How could normal user obtain root password or change root password ckamheng Debian 18 02-18-2009 11:28 PM
Change my root password in Debian Linux if I have the current password? panseluta Linux - Newbie 2 12-28-2008 03:02 AM
scp needs three times password in wrong password case!!! JATA01 Programming 6 12-01-2008 06:28 AM
How to retrieve( or reset) root password in Mandrake Linux, as I forgot my password? Reghunath Linux - Software 4 05-08-2008 05:11 AM


All times are GMT -5. The time now is 10:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration