LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-16-2017, 03:29 PM   #1
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Lost my root password in a VM


I have a Ubuntu VM and I destroyed the password on the admin user (I was foolishly renaming the user).

Do I just get a fresh DVD to reset the user password?
I'm loath to re-configure a completely fresh version of the VM.
 
Old 12-16-2017, 07:34 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,341
Blog Entries: 28

Rep: Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145
I think this thread from Ubuntu will be helpful: https://askubuntu.com/questions/2400...ative-password
 
Old 12-16-2017, 10:33 PM   #3
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
Yes (dvd) but this gives me a chance to post a 'burning Story share' here:
Yesterday, my fav trick, grub e init=/bin/sh rw, failed (I think it just rebooted!!!)
Further inspection (as user; root inaccessible) found: sh -> dash; static-sh -> busybox!!!
On that circa-6/14 FrankenMint(?) init=/static-sh got me a uid 0 #, so I could 'attack' shadow.
Strange? Normal? p.s. hdd 'rescue' didn't (seem to) work &isn't primitive enuf for this mll user

Last edited by !!!; 12-17-2017 at 03:32 AM.
 
Old 12-16-2017, 11:12 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
You boot the install DVD into rescue mode, open a root shell, and change the PW with passwd.
 
Old 12-17-2017, 08:10 AM   #5
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Original Poster
Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Normal methods don't work in a VM.

I suppose I could create a second VM, create appropriate users & copy appropriate bits of
/etc/passwd & /etc/shadow into the first VM (which I spent some time on configuration)?
 
Old 12-17-2017, 09:02 AM   #6
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,375

Rep: Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754Reputation: 2754
Have you tried mounting the VM image, so that you can edit it directly?
I recently used the procedure here for a raw image containing logical volumes and it worked for me. I have also used qemu-nbd with success in the past.
 
Old 12-17-2017, 10:21 AM   #7
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Original Poster
Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
!!!!!Yuck!!!!! That
Code:
https://somepalli.wordpress.com/2015/10/01/how-to-mount-virtualbox-vdi-with-lvm-partition-on-ubuntu/
I wouldn't try that procedure - it sounds so very risky with regard to the non-VM components on my PC.

I've been trying to edit the VM and destroyed it; but it wasn't of value beyond a considerable time configuring it.
So the question is now moot for me.
 
Old 12-18-2017, 05:56 PM   #8
Mill J
Senior Member
 
Registered: Feb 2017
Location: @127.0.0.1
Distribution: Mint, Void, MX, Haiku, PMOS, Plasma Mobile, and many others
Posts: 1,258
Blog Entries: 2

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Doesn't it work to change the virtual optical drive for the VM to a live iso and booting?

Last edited by Mill J; 12-18-2017 at 05:57 PM.
 
1 members found this post helpful.
Old 12-18-2017, 07:22 PM   #9
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Original Poster
Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
Normally I would have been able to edit GRUB to get into single-user mode & fix it that way.

However, starting a VM hides all this and whilst I tried booting with a live DVD, this doesn't contain a relevant password entry.
Actually, I'm pretty certain that renaming a user in the /etc/passwd file was a stupid thing to do.

Anyway, the VM has now been replaced.
Thanks for your interest.
 
Old 12-19-2017, 03:04 AM   #10
!!!
Member
 
Registered: Jan 2017
Location: Fremont, CA, USA
Distribution: Trying any&ALL on old/minimal
Posts: 997

Rep: Reputation: 382Reputation: 382Reputation: 382Reputation: 382
Oh, ooops, you're probably not using VirtualBox

qemu? kvm? (time to 'bump' these up, on my to-learn list)

Last edited by !!!; 12-19-2017 at 03:05 AM.
 
Old 12-19-2017, 03:25 AM   #11
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,350

Rep: Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331Reputation: 2331
There's a line about HIDDENMENU in /etc/default/grub, and if you comment that out, you can at least see what's going on.
 
Old 12-19-2017, 07:26 AM   #12
_roman_
Member
 
Registered: Dec 2017
Location: _Austro_Bavaria_
Distribution: gentoo / linux mint
Posts: 433

Rep: Reputation: 29
Just setup the user again.
I assume you are aware of

Quote:
ASUS-G75VW /home/roman # man useradd
ASUS-G75VW /home/roman # man userdel
You should never use an editor on those files respectively
 
1 members found this post helpful.
Old 12-19-2017, 07:32 AM   #13
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Original Poster
Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
No - I am using VirtualBox - it seems to be rather inefficient, but easy to set up.
Must try to see if kvm runs on a spare ancient laptop to see what happens.

Quote:
qemu? kvm? (time to 'bump' these up, on my to-learn list)
 
Old 12-19-2017, 07:53 AM   #14
joe_2000
Senior Member
 
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,016

Rep: Reputation: 308Reputation: 308Reputation: 308Reputation: 308
You could boot a live image and chroot into the system to change the root and/or user password...

Last edited by joe_2000; 12-19-2017 at 07:54 AM.
 
Old 12-19-2017, 08:43 AM   #15
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,947

Original Poster
Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
I don't usually use Ubuntu.
As a VirtualBox VM there's no way to drop into a CLI.

I'm coming to realise that I'd already messed up the VM (by editing /etc/passwd) and anyway Ubuntu isn't keen on letting you use root in the GUI.
 
  


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
I lost root password. knockout_artist Linux - Newbie 15 11-29-2007 11:18 PM
Lost Root Password Mr.Smith Mandriva 2 11-27-2006 11:20 PM
Root Password Lost ! gurmeet.bedi Linux - Security 1 10-17-2006 07:01 AM
Lost root password dbruesch SUSE / openSUSE 12 09-06-2006 06:33 PM
lost root password thick_guy_9 Slackware 2 03-07-2005 08:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:54 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