LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 07-13-2009, 08:17 PM   #1
vbo
Member
 
Registered: Jan 2006
Location: Turkey
Distribution: Pardus,Fedora,Suse,Many livedistros
Posts: 36

Rep: Reputation: 15
Root password on Ubuntu


Hi,
I have a Ubuntu server box installed by someone i know and only a root user is created on it. He nearly showed me the root password by showing the keyboard but im not able login. I own the box but cant reach the person who installed so i need to find /hack/change etc the password. I did on some Fedora boxes for a long time but cant remember how to on Ubuntu.
 
Old 07-13-2009, 08:53 PM   #2
foodown
Member
 
Registered: Jun 2009
Location: Texas
Distribution: Slackware
Posts: 611

Rep: Reputation: 221Reputation: 221Reputation: 221
You just need to boot your system from a boot disk, like a USB stick or distro CD/DVD.

Once you get to a console, mount your usual root file system to /mnt

Then, edit /mnt/etc/shadow

Delete the hash of root's password.

Then, reboot and you should be able to log in as root with no password.
 
Old 07-14-2009, 02:35 AM   #3
vbo
Member
 
Registered: Jan 2006
Location: Turkey
Distribution: Pardus,Fedora,Suse,Many livedistros
Posts: 36

Original Poster
Rep: Reputation: 15
Thanks for the answer i sometimes forget this simple thing. I have booted the server with the Knoppix 5.1.1 CD, but it couldnt find and mount the harddisk of the server, though it found and automaticly founded and mount the usb stick. I opened the Qparted and saw there /dev/cciss/c0d0 ...d1 ..d2 etc entiries . So i made a directory called disk with mkdir and used mount /dev/dev/cciss/c0d0,1,2,3 whatever to /mnt/disk but it always said that there is no such device. Its HP server box , so how can i find the root parition and mount it?
 
Old 07-14-2009, 03:11 AM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
If the boot process is via grub, you should be able to interrupt the process at the menu, hit escape to edit, select the entry you'd normally boot, hit e to edit, add "single" without the quotes at the end of the kernel line, then b to boot.

That should drop you in the shell and allow you to edit shadow. I haven't tried it on Ubuntu though, so no guarantee. Keys from memory too!!!
 
Old 07-14-2009, 03:17 AM   #5
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Rep: Reputation: 75
try first:
sudo -s
passwd
or
sudo passwd root

edit- I just realized there is only the root account this will not work of course -/edit

Last edited by micxz; 07-14-2009 at 03:38 PM. Reason: spaces add comment
 
Old 07-14-2009, 06:57 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
If you can boot into single-user mode, all you have to do is enter "passwd root".

Surprising to see a Ubuntu system with ONLY a root account. They normally start with an "Alpha user" who has full admin privileges, and NO root account. If the alpha user tries to do something, they are asked for THEIR password and not root's.
 
Old 07-14-2009, 03:07 PM   #7
foodown
Member
 
Registered: Jun 2009
Location: Texas
Distribution: Slackware
Posts: 611

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by vbo View Post
I opened the Qparted and saw there /dev/cciss/c0d0 ...d1 ..d2 etc entiries . So i made a directory called disk with mkdir and used mount /dev/dev/cciss/c0d0,1,2,3 whatever to /mnt/disk but it always said that there is no such device.
If you really entered 'mount /dev/dev/cciss/c0d0,1,2,3' then you should only use one instance of /dev . . . eg 'mount /dev/cciss/c0d1'

The easiest way I can think of to figure it out is to open the device with cfdisk and figure out which one it is by the size of the partition.
 
Old 07-15-2009, 02:33 AM   #8
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
If you use sudo to gain root privileges, and do not have the root account enabled (which is not recommended in Ubuntu anyway), then here is how to reset your password:
http://www.psychocats.net/ubuntu/resetpassword
 
Old 09-17-2009, 05:08 PM   #9
Doinkxs
LQ Newbie
 
Registered: Mar 2005
Location: UK
Posts: 14

Rep: Reputation: 0
Hi,

I still have a problem to get my passwords right, here is my problem:
My laptop is Dell Inspiron Mini (this means no CD, floppy, etc. and I have no external HDD). Ubuntu automatically logs in with user account (user1). During installation password was entered but not remembered and now I can not recall it. It would be no problem to do password reset with recovery mode, but I can not access GRUB. After computer start screen, I see MBR letters flashing and after that Ubuntu splash screen appears loading system. If I press ESC in any other moment before Ubuntu loading I have this on screen: "MBR 2FA:" (pressing 1 at this moment enters system testing mode).

I need help with solutions I can think of:

1. How can I find what is the password of User1 (I am already logged in).
I think it should be easiest way, but I dont know where to look.
2. How can I set up GRUB to make it accessible on boot?
Actually, is it GRUB or other boot loader, how can I check?
3. Any other way?
Re-install is very problematic and I hope to avoid it

Thanks in advance.
 
Old 09-17-2009, 08:45 PM   #10
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
Quote:
Originally Posted by Doinkxs View Post
1. How can I find what is the password of User1 (I am already logged in).
I don't think that is possible.
Quote:
Originally Posted by Doinkxs View Post
2. How can I set up GRUB to make it accessible on boot?
Actually, is it GRUB or other boot loader, how can I check?
Ubuntu uses grub. Hitting the Esc during boot before Ubuntu starts to load should display the grub menu. I don't why it does not in your case.
To make the grub menu visible when you boot, open /boot/grub/menu.lst using gedit text editor with gksudo like this:
Code:
gksudo gedit /boot/grub/menu.lst
This will open menu.lst in the gedit text editor with sudo privileges. Scroll down to this section:
Code:
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu
Put a comment (#) in front of the word hiddenmenu that I have in bold there. Then save and exit. Then when you reboot the grub menu should be visable on boot.
http://members.iinet.net.au/~herman5...ml#hidethemenu
Also, right above the hiddenmenu section there is the timeout section:
Quote:
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10
Make sure the timeout is set to 10, so you have time to select recovery mode when Ubuntu boots.
Then boot Ubuntu and select recovery mode from the grub menu and reset the super user password as per this article:
http://www.psychocats.net/ubuntu/resetpassword
To edit menu.lst you will need sudo privileges, which requires the password. If you are asked for the root password when you run gksudo gedit and don't know it, this will be a problem. In that case boot from a live CD, mount your Ubuntu partition and cd into /mnt/boot/grub/ and edit menu.lst, Then reboot into recovery mode.

Last edited by tommcd; 09-17-2009 at 08:55 PM.
 
Old 09-18-2009, 12:41 AM   #11
Doinkxs
LQ Newbie
 
Registered: Mar 2005
Location: UK
Posts: 14

Rep: Reputation: 0
Thanks for reply.

1. I get it.

About GRUB you are hundred percent right. I can open /boot/grub/menu.lst and see that timeout is 0 and hiddenmenu is on. That is why I do not see menu. Unfortunately, I am asked for 'your' password , which I do know and I am unable to edit this file.

This 'your' password is only user1 password or you can enter root password as well (if it is enabled)? How can I check if root is enabled or not?
I have no CD drive or other device), but biggest stick I have at the moment is 256 MB, is there any option how can I boot from such small stick and than mount Ubuntu partition and edit this file?
 
Old 09-18-2009, 01:58 AM   #12
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
Quote:
Originally Posted by Doinkxs View Post
I can open /boot/grub/menu.lst and see that timeout is 0 and hiddenmenu is on. That is why I do not see menu.
First, try hitting the Esc as soon as you push the power button to turn on the computer. Since the timeout in grub is 0, you will have to be really quick with the Esc key. If you can catch it fast enough you may be able to get into the grub menu and choose recovery mode.
Quote:
Originally Posted by Doinkxs View Post
I have no CD drive or other device), but biggest stick I have at the moment is 256 MB, is there any option how can I boot from such small stick and than mount Ubuntu partition and edit this file?
You can use UNetbootin to create a bootable usb stick that you can use to boot into like a live CD. You should then be able to edit the grub menu once you mount your root partition.
http://unetbootin.sourceforge.net/
A 256mb usb stick is not big enough for Ubuntu. UNetbootin supports a number of mini distros like Puppy, DSL, and SliTaz. All of those should fit on the 256mb usb stick.
 
  


Reply



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
Root password in Ubuntu??? ART6 Linux - Newbie 1 07-31-2008 11:48 PM
How to reset root password in Ubuntu? concoran Linux - Newbie 7 12-13-2007 03:04 PM
root password in ubuntu??? GEJOE DANIEL Ubuntu 7 10-01-2005 09:51 AM
How do I get my root password in Ubuntu? GameGuru Linux - Newbie 9 09-09-2005 10:46 AM
One more; Root-password in Ubuntu 5.04 Waerner Linux - Newbie 17 06-16-2005 06:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 06:25 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
Open Source Consulting | Domain Registration