Fc4 And Root Password Can Not Be Recover


Recommended Posts

I have got Linux FC4 , I forgot password for root.

How can I recover it through rescue CD1 (I did it through GRUB), but I am looking to do it through CD1

I used FC4 CD1 to boot PC in rescue mode

1- F5 for recue mode

2- Type in : rescue mode----press Enter.

2- chroot /mnt/sysimage

3- Sh-2.95b # passwd root,,,,the output was :

Passwd: system_u:system_r:anaconda_t is not authorized to change the password of root

4- I tried type in : passwd (with out word "root" see step 3)

Where is my mistake ?

Edited by zillah
Link to post
Share on other sites

Start booting normaly but at grub screen type e, add single to kernel parameter, press enter and then b to boot into single usrer mode (logs in as root with no password). You can then do passwd root to change it (I don't belive you will be asked for current password, but am not certain). If that doesn;t work you will need to edit /etc/shadow.

Link to post
Share on other sites

what you are doing looks like it should work. I have never used the fedora disks in that fashion. If you would like to learn a universal way that would work with any distro. I will show you. You will need to use a live linux cd like knoppix, or any of the others available.

First you will need to boot your knoppix cd. Then open up a shell and change to the user root with the su command. You will then need to figure out where your root(main) linux partition is located. /dev/hda is your first ide(primary) drive, /dev/hdb is your second ide(slave) drive. You will use the fdisk command to print out your partition table. Since linux is installed on my primary drive, /dev/hda, I will use this command, it then prints the following info

mainbox shane # fdisk -l /dev/hda  

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 3824 30716248+ 83 Linux
/dev/hda2 3825 3848 192780 83 Linux
/dev/hda3 3849 3911 506047+ 82 Linux swap / Solaris
/dev/hda4 3912 9729 46733085 5 Extended
/dev/hda5 3912 7558 29294496 83 Linux
/dev/hda6 7559 9729 17438526 83 Linux

I have three different distros installed, they are located at /dev/hda1, /dev/hda5, and /dev/hda6. for my example I will change the password for the linux distro installed at /dev/hda1.

you will then need to make a mount point, this is a place to attach your partition. This can be a directory located anywhere, it can be named anything

mkdir /mnt/linux

now you will need to mount(attach) your linux partition to that directory

mount /dev/hda1 /mnt/linux

The following command probably is not needed, but it may be. Just in case the proc file system is needed to set your root password, do the following

mount -t proc proc /mnt/linux/proc

now you can change the root directoy using the chroot command

chroot /mnt/linux /bin/bash

now you should be able to set you root password

passwd root

now make sure you exit out properly with the command

exit

Edited by shanenin
Link to post
Share on other sites

Thanks shanenin for this nice and detailed explaination

/dev/hda is your first ide(primary) drive, /dev/hdb is your second ide(slave) drive.

You meant salve on the first ide (primary), not second. Because for second ide it will be named as hdc and hdd,,,,,,,,,,didn't you ?

/dev/hda2			3825		3848	  192780   83  Linux

What have been installed here ?

Again thanks for this explaination

Link to post
Share on other sites
You meant salve on the first ide (primary), not second. Because for second ide it will be named as hdc and hdd,,,,,,,,,,didn't you ?

I think your ide devices are labled like this:

ide0 master /dev/hda -first

ide1 slave /dev/hdb -second

ide2 master /dev/hdc -third

ide3 slave /dev/hdd -fourth

I guess I am not sure. I may be lableing them wrong, I assumbed the master and slave were two seperate ide devices. Maybe someone else can jump in and clarify :-)

/dev/hda2 3825 3848 192780 83 Linux

What have been installed here ?

that is my boot partition, you may or may not have one. the boot partition contains both my kernel and grub files. It is not nessesary to have a seperate partition for your /boot directory.

Link to post
Share on other sites
I think your ide devices are labled like this:

ide0 master /dev/hda -first

ide1 slave /dev/hdb -second

ide2 master /dev/hdc -third

ide3 slave /dev/hdd -fourth

In your motherboard you have two IDEs (controllers) which are IDE0 (primary) and IDE1 (secondary).

In each IDE you can two hard disks master and slave,,,That means :

1- You have primary master (Linux hda) and primary slave (Linux hdb).----If both HD are connected to one cable to IDE0 (primary) then linux will name them hda and hdb respectivly

2- You have secondary master (Linux hdc) and secondary slave (Linux hdd).------If both HD are connected to one cable to IDE1 secondary then linux will name them hdc and hdd respectivly

Edited by zillah
Link to post
Share on other sites

Thank you for clarifying that, you are definately correct.

I think I was confused by the way grub names its hard drives

hd0 -first harddrive

hd1 -second harddrive

hd2 - third harddrive

that made me think incorrectly the following was also true:

ide0 -first device

ide1 -second device

ide2 -third devide

Link to post
Share on other sites
I have got Linux FC4 , I forgot password for root.

How can I recover it through rescue CD1 (I did it through GRUB), but I am looking to do it through CD1

I used FC4 CD1 to boot PC in rescue mode

1- F5 for recue mode

2- Type in : rescue mode----press Enter.

2- chroot /mnt/sysimage

3- Sh-2.95b # passwd root,,,,the output was :

Passwd: system_u:system_r:anaconda_t is not authorized to change the password of root

4- I tried type in : passwd (with out word "root" see step 3)

Where is my mistake ?

sorry this took so long.. I did not see this thread

see this site ..

http://searchopensource.techtarget.com/tip...i1151572,00.htm

it looks like it did not make you root? why ... I believe you are running

SELINUX on.. yes?

if so then booting from a cd would not be at the lowest label (the lable at which booting from grup single would be)

this is a secuerity feture added in SELINUX .... a cdrom from boot doing a chroot should come in at a mid-level label (haveing no labels its self)

The way you did it would work on FC - FC 3 but not FC4

Edited by iccaros
Link to post
Share on other sites
sorry this took so long.. I did not see this thread

Thanks for your reply.

SELINUX on.. yes?

Yes,,,this is my problem,,,,How can I disable this.

short answer is you can't..

you must be root and you must have the correct lables (inode keys) to come in as root. Red Hat is testing SELINUX in Fedora core 4 and have not created to correct tools for administration as of yet..

you must know the root password to log in as root and set enforce = 0 (selinux enforce =0)

sorry, But you may have to rebuild.

Remeber SELIUNUX is not ment for causal use.. its ment to lock down to US Government standards for a Trusted systems (IE Trusted Solaris)

the long short answer..

you might try booting with a non-selinux disk (knoppix) mount your partition and then chroot /mountpoint /bin/bash

then change password.. the problem is you will have to reset file inforamtion back to SELINUX before booting the main system, problem agian is you need to be sysadm_r role to do so.. as you justed saved a file with no inode information.. (aka labels..)

if you have no need for that much secuerity (most users will not) then I would reinstall with selinux off

helpfull documentation

http://www.crypt.gen.nz/selinux/install_fedora.html

Link to post
Share on other sites
  • 1 month later...

I rested the password , I was able to login without any problem after reseting,,,after while (I have not used Linux PC for about 20 days) I came again,,,I could not login!!!

Can be there is something (some setting mistakenly I configured it when i installed FC4) changing the password ?

Link to post
Share on other sites
I rested the password , I was able to login without any problem after reseting,,,after while (I have not used Linux PC for about 20 days) I came again,,,I could not login!!!

Can be there is something (some setting mistakenly I configured it when i installed FC4) changing the password ?

if you get back in.. check under /etc/defult

this is defult setting for users and the system.. in mine I have a file called useradd.. which says that expire = 180.. meaning that user accounts expire in 180 days if not used.. you may have something simular..

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...