forgot root password need Help in resetting

Moderator: mike

Post Reply
vee1283
Posts: 3
Joined: Sun Jul 19, 2020 5:52 am

forgot root password need Help in resetting

Post by vee1283 » Sat Sep 19, 2020 2:14 am

Hi all,

I am using eve-ng on vmworkstation pro, i forgot my root password root/eve doesnt work for me.
need help in resetting the password.
Thanks in advance.

g4t0l0c0
Posts: 12
Joined: Fri Sep 18, 2020 2:08 am

Re: forgot root password need Help in resetting

Post by g4t0l0c0 » Sat Sep 19, 2020 2:33 am

You need a linux usb/live distribution,

Any distro will work.

Quick steps:

Boot your machine with the live usb.

Mount the eve-ng partition

Access the root (/) partition and edit the passwd file by replacing the root password with a blank one.

reboot normally

Login as root with no password

create a new one and put eve again.

---------

Now before getting into too much detail....are you trying to access via ssh/console or the webgui? Because webgui is ' admin' ' eve' , not ' root' . Well I use the community version, I dont think thats different though.

vee1283
Posts: 3
Joined: Sun Jul 19, 2020 5:52 am

Re: forgot root password need Help in resetting

Post by vee1283 » Sat Sep 19, 2020 3:38 am

Thanks g4t0l0c0 for your reply. i am able to login to UI using admin/eve facing issues only with root

g4t0l0c0
Posts: 12
Joined: Fri Sep 18, 2020 2:08 am

Re: forgot root password need Help in resetting

Post by g4t0l0c0 » Sat Sep 19, 2020 4:03 pm

OK. [DISCLAIMER] - This shouldn't be destructive or anything like that, but I held no responsibility if you follow these steps, afterall you're following a "guide" from a guy off the Internet, this is your decision.

I'll try to explain the best I can.

Well, Not sure if you're familiar with linux, but shouldn't be that hard. First download a linux distro. For this you can use Linux Mint.

It will be more user friendly.

mint cinammon edition: https://www.linuxmint.com/edition.php?id=281 (choose a mirror according to your location)

---------------------PART 1------------------------------------------------------------------------------------------------------------------------------

After downloading, make the ISO a bootable USB, You can use unetbootin, balena etcher or rufus on Windows, rufus and balena etcher worked better for me.

1. Boot the PC with USB of course.
2. Log in and fireup a console and escalate to root privileges: 'sudo -s' [ENTER]
3. fdisk -l to list your disks info. This is just to identify the partition with eve's root partition. Should be /dev/sda[5] the one labeled as LVM.

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1953791 1951744 953M 83 Linux
/dev/sda2 1953792 17577983 15624192 7.5G 82 Linux swap / Solaris
/dev/sda3 17580030 937701375 920121346 438.8G 5 Extended
/dev/sda5 17580032 937701375 920121344 438.8G 8e Linux LVM <---- This is usually the case for most eve installations

4. After identifying the root (/) partition of your eve server and we need to mount it.

Go to root (/) and create a folder to mount it first: 'cd /' (This is the live USB root folder)
'mkdir everoot' [ENTER]
'mount /dev/sda5 everoot' [ENTER]

5. At this point the eve root partition should be mounted. Access this folder and list the contents: 'cd /everoot' [ENTER], 'ls -lh' [ENTER]

If you see 'opt, bin, sbin, etc, home' , then you're golden.

NOTE: Type always the full path when copying, moving, opening files etc. This will prevent confusion between the live usb root folder and the 'everoot' mount.

root@eve-ng-srv:/everoot# ls
bin home lib32 mnt run tmp vmlinuz.old
boot initrd.img lib64 opt sbin usr
dev initrd.img.old lost+found proc srv var
etc lib media root sys vmlinuz

6. Now it is a matter of editing the 'passwd' file. This file contains the systems pass and userinfo. So before and just in case, make a backup: 'cp /everoot/etc/passwd /everoot/etc/passwd.bak'

7. List the content of the passwd file with cat. 'cat passwd'. Look for the line containing root(should be one of the first ones): 'root::x::0:0:root:/root:/bin/bash'<---------
Hint, cat will output all the contents, so scroll back up the console to search upwards.
You will notice an "x" right after 'root:'. That is what we need to edit.

8. Fire up nano (text editor), and edit the file: nano /everoot/etc/passwd.

change the line: 'root::x::0:0:root:/root:/bin/bash' (remove the "x")

to: root::0:0:root:/root:/bin/bash

Then CRTL^X to Exit and hit "Y" when prompted. Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
[ENTER] to confirm.

If everthing went OK so far. You 're good to go, you just changed the root account to be accessed without a password or 'blank'.

You can reboot the machine at this point, but there are a few more steps that need to be performed on eve once you login.

DO NOT change the password YET! Read PART 2

------------PART 2------------------------------------------------------------------------------------------------------------------

1. Log in with root, when prompted for a password just hit [ENTER]

Remembered the "X" you removed from the passwd file? Well in that line, after the username between the first '::', that is the placeholder for an actual password or an X which tells the system to store
the password encrypted in another file called 'shadow'. We removed the X, telling the system to use a 'blank' password. But if you leave that as it is and create a new password, the password will be stored
directly within this file, and we don't want that. So before creating the new password, we just insert the 'x' back. But since we made a backup, lets just replace the file with the backup one.

2. Replace the passwd file with the backup you made earlier. 'cp /etc/passwd.bak /etc/passwd' and display the contents to make sure line is back to normal: root::x::0:0:root:/root:/bin/bash

3. Create a new password 'passwd' [ENTER]

Enter new UNIX password: eve
Retype new UNIX password: eve

4. Log out and log in again.


This may seen as a long post, and c'mon, the passwd is 'eve', this is just for labs, etc, but this method will work for almost if not every linux distro. Even many linux based software from many vendors, including VMWARE, Cisco, etc. So I hope you learnt something and this is helpful.

2608naa
Posts: 2
Joined: Sun Sep 27, 2020 7:32 pm

Re: forgot root password need Help in resetting

Post by 2608naa » Sun Sep 27, 2020 11:39 pm

I got as far as the 4th Step in Part 1 but I get an error when trying to mount /dev/sda5

Code: Select all

mount: /everoot: unknown filesystem type 'LVM2_member'
I am not very good at linux but did follow the steps word for word.

Is there a way out for this error?

I wish to reset the root password.

disks.JPG
mount_error.JPG
You do not have the required permissions to view the files attached to this post.

2608naa
Posts: 2
Joined: Sun Sep 27, 2020 7:32 pm

Re: forgot root password need Help in resetting

Post by 2608naa » Mon Sep 28, 2020 3:59 am

This link helped combined with the youtube video helped. https://tipsonubuntu.com/2016/09/02/res ... tu-16-04/

https://www.youtube.com/watch?v=6I84hLO73QY


Your instructions are very detailed and helpful too.
After booting into root I simply ran 'passwd root' ↵
And updated the password.

Post Reply