Results 1 to 8 of 8

Thread: Root password during after install

  1. #1
    Join Date
    Jun 2008
    Location
    Davenport, IA
    Posts
    17

    Exclamation Root password during after install

    Hello,

    I have managed to lock myself out of my root account...

    I just installed openSUSE 11.4, and during the install, I set the root password to be different then my regular user password. Both passwords I've used for a while and know backwards and forwards so it's not a case of simply forgetting a new password.

    The thing is, I managed to mis-type the root password wrong 2x in a row. I have tried all my passwords numerous times, with and without caps lock, I've tried su -, sudo and logging in directly as root. All to no avail. It always returns authentication failure.

    I know this is a worst case senario and am expecting that the easiest way to fix is just to reinstall (Not a big issue since I just installed) but I figured I would ask if anyone had a good way to fix this.

    Thank you,

    Paul Allen

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,681
    Blog Entries
    3

    Default Re: Root password during after install

    The usual trick is to boot a rescue CD or DVD, mount the root partition, edit "mountpoint/etc/shadow", delete the password (the string between two ":"), umount.

    Then, when you restart your system, root does not need a password. A live CD or a parted magic CD should do as a rescue system if you don't have one specifically for 11.4.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  3. #3
    Join Date
    Mar 2010
    Location
    Europe
    Posts
    657

    Default Re: Root password during after install

    Quote Originally Posted by antiparadigm View Post
    Hello,

    I have managed to lock myself out of my root account...

    I just installed openSUSE 11.4, and during the install, I set the root password to be different then my regular user password. Both passwords I've used for a while and know backwards and forwards so it's not a case of simply forgetting a new password.

    The thing is, I managed to mis-type the root password wrong 2x in a row. I have tried all my passwords numerous times, with and without caps lock, I've tried su -, sudo and logging in directly as root. All to no avail. It always returns authentication failure.

    I know this is a worst case senario and am expecting that the easiest way to fix is just to reinstall (Not a big issue since I just installed) but I figured I would ask if anyone had a good way to fix this.

    Thank you,

    Paul Allen
    Booting from a (11.4?) liveCD and chrooting into your installed system seems like an option to me. IIRC, this does not require the root password of the installed system and yet gives you access to yast and the User and Group Management.

    Here is a sequence of commands that I noted down from somewhere on these forums.
    mount /dev/sdXX /mnt
    mount --bind /dev /mnt/dev
    chroot /mnt
    mount /proc
    mount /sys
    yast

    '/dev/sdXX' needs to be adapted to your situation. It is worth a try, I guess.

  4. #4
    Join Date
    Jun 2008
    Location
    Davenport, IA
    Posts
    17

    Default Re: Root password during after install

    nrickert & Lord_Emsworth,
    That definitely seems to be the way to go. I had a partial success (outlined below) last night, but had to give up due to time of night. I simply had to stop and go to bed since I get up pretty early for work.
    What I did was:
    1. Boot up off of the openSUSE 11.4 install DVD.
    2. Chose "Rescue Disc" from the boot menu
    3. After it booted, typed "root" to login (no password needed)
    4. Made a directory to mount the drive under, mkdir /mnt/rootfs
    5. Mounted the root filesystem. mount /dev/sdXX /mnt/rootfs
    6. CD into the /etc directory on the file system, cd /mnt/rootfs/etc/
    7. Edit the shadow file from there. vim shadow
    8. In the shadow file, I found the line for the root user, and saw a long string of characters between "::" IIRC, password hashes are between $ symbols and the string matched that pattern so I deleted it all between the "::".
    9. Now, this is where I think I failed. I think I forgot to save... DOH!
    10. Rebooted into the installed version of openSUSE and tried to login as root. Failed. Login as myself and try to su - and fail.

    I then decided that it was getting late and this isn't one of those things that is super critical at the moment, so I decided I'd try tonight.
    I'm going to try tonight and I will post the results after I am done. Thank you for your help

  5. #5
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,681
    Blog Entries
    3

    Default Re: Root password during after install

    I just did what I should have done earlier. I tested my own advice by editing "/etc/shadow" and setting a user account to have an empty password field.

    It didn't work. Maybe this is caching by "nscd", but I suspect that there is another configuration setting somewhere that says that users without password are not allowed.

    My alternative suggestion. Again, while in with a rescue disk and editing "/mountpoint/etc/shadow" - change the password field in the root line to be identical to that your own user account. That should force the root password to be identical to your user password.

    The easiest way to copy using "vim" might be to use the "Y" command (Yank) on your own entry line, then position the cursor to the root line and use "P" (pull) to replicate that line. Then change the user on that line to root, and then delete the original root line. That should be easier than typing a long string of meaningless characters.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  6. #6
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Root password during after install

    On 2011-04-06 17:06, nrickert wrote:
    >
    > I just did what I should have done earlier. I tested my own advice by
    > editing "/etc/shadow" and setting a user account to have an empty
    > password field.
    >
    > It didn't work. Maybe this is caching by "nscd", but I suspect that
    > there is another configuration setting somewhere that says that users
    > without password are not allowed.


    If I recall correctly, the password is stored in shadow, but the idea of
    using a password is defined in passwd. I think you have to remove the x of
    ":x": in that other file.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

  7. #7
    Join Date
    Jun 2008
    Location
    Davenport, IA
    Posts
    17

    Default Re: Root password during after install

    All,

    Thank you for your help. After trying both methods (Removing the "X" and copying the hash of my regular account) I have failed at both. I then decided that it would be faster just to reinstall. This isn't a huge issue as far as data loss since I had just installed anyways. I just figured I might be able to fix it and get it done with that way. I'm guessing that somewhere else though, openSUSE caches the password.

    I am pretty sure I did what was needed. I've been using linux since Mandrake 7.0 (~1998) I've just been a distro junkie (I have actually claimed this "SuSe" as my distro of choice since 7.0 - Even bought the box version when a new one came out). Since getting my degree in computer science (2 years ago) I have been in a Microsoft world since that has been the skills that employers in this area are looking for.

    This post and subsequent replies has really highlighted the best of the community and I really am appreciative of all the help I have received. So, again, thank you for taking the time to respond and I hope that this post will point someone in the right direction in the future.

  8. #8
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Root password during after install

    On 2011-04-08 03:36, antiparadigm wrote:
    >
    > All,
    >
    > Thank you for your help. After trying both methods (Removing the
    > "X" and copying the hash of my regular account) I have failed at both.
    > I then decided that it would be faster just to reinstall. This isn't a
    > huge issue as far as data loss since I had just installed anyways. I
    > just figured I might be able to fix it and get it done with that way.
    > I'm guessing that somewhere else though, openSUSE caches the password.


    No, that is not possible.
    If it did not work, it is because we need to do it some other way.

    The letter that goes in between those "::" in the password file have a
    special meaning I always forget. It must be documented somewhere.

    The method to change the root password I know I have read it many times,
    but not having had to use it, I always forget it. Google, perhaps.


    > http://www.cyberciti.biz/faq/underst...tcshadow-file/
    > http://www.cyberciti.biz/faq/underst...-file-format//



    passwd file:
    x --> password is in the shadow file.
    * --> same?
    encrypted passwd

    empty I think means no password.


    shadow f:
    ! --> No login, except root via su
    * --> no login ?
    encrypted passwd ($... not DES algorithm)

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •