LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Root password on Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/root-password-on-ubuntu-739868/)

vbo 07-13-2009 08:17 PM

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.

foodown 07-13-2009 08:53 PM

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.

vbo 07-14-2009 02:35 AM

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?

billymayday 07-14-2009 03:11 AM

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!!!

micxz 07-14-2009 03:17 AM

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

pixellany 07-14-2009 06:57 AM

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.

foodown 07-14-2009 03:07 PM

Quote:

Originally Posted by vbo (Post 3606932)
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.

tommcd 07-15-2009 02:33 AM

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

Doinkxs 09-17-2009 05:08 PM

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.

tommcd 09-17-2009 08:45 PM

Quote:

Originally Posted by Doinkxs (Post 3687704)
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 (Post 3687704)
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.

Doinkxs 09-18-2009 12:41 AM

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?

tommcd 09-18-2009 01:58 AM

Quote:

Originally Posted by Doinkxs (Post 3688094)
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 (Post 3688094)
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.


All times are GMT -5. The time now is 12:15 AM.