News:

FOR INFORMATION ON DONATIONS, AND HOW TO OBTAIN ACCESS TO THE GAME, PLEASE VIEW THE FOLLOWING TOPIC: http://stick-online.com/boards/index.php?topic=2.0

Main Menu

Need help to recover, retrieve, remove, or reset root password(Linux)

Started by Jackabomb, January 20, 2012, 09:49:13 AM

Previous topic - Next topic

Jackabomb

I have a tech problem I'd like you guys' help with. Here's the story:

Back in October of 2010, Scotty helped me set up a VirtualBox virtual machine for Ubuntu Linux. It didn't work at first, but I re-downloaded everything then it worked. Anticlimactic? Yes, I know it is, hold on. Ever since I have been happily using to write C++, write assembly, test assembly, write OS code, burn discs, erase discs, burn more discs, and of course, increase my computer knowledge...until now. I have an external hard drive that connects to the computer via a USB cable. I wanted to do low-level read using dd from the drive to a file.
Problem: I don't have permission to access the device file.
Solution: Oh. I'll just su root.
Problem: I need a password.
Solution: Oh. I use passwords every day. I'll just type in the password.
Big Problem: I don't even remember setting this password, much less what it might be!
Peripheral Problem: It's on a virtual machine. Removing the hard drive isn't an option.


Any other information needed, I'd be happy to provide if it helps.

Scotty

This is where it would get extremely tricky.  I can't say I've had this problem, so a lot of what I'd recommend is guess work based off similar issues.  The real difficult part is that you have it on a VM.  You might try to do some research (I can't help ya on that, at work at the moment) and see if you can somehow have it read off the Ubuntu installer disk, while mounting the hard drive.  That way it would boot up the disk, and you can try the "demo" version without installing it over your pre-existing installation.

Problem after that comes when it asks you for a password to mount the old hard drive.  I'll try to dig around a bit on that.

Jackabomb

Strange fact: I can sudo just fine using my own password, but I can't su. I wonder why. What is the difference between the two? I think I might just load my personal files onto the external drive, make a list of programs to reinstall that I use, then make a new VM using a new disk image...it wouldn't be hard to do, but I'd rather not. Just saying, it wouldn't be too hard to do. Either way, it looks like I'll need a new cd image. I'll go get one.


[EDIT] I have solved the problem by using the recovery console to reset the root password. A new problem arose that seems to have suddenly righted itself. When I tried to log in as a user again, I got several strange error messages and it froze before it loaded my session. To fix this, I logged as the root and created a new user called main that(hopefully) would be identical to my old account. I used adduser at least 12 times making sure I had all the groups right. Anyway, after copying all the files from the home directory into main's and using chmod, chown, and chgrp to make sure everything was good to go, I logged in as main. Everything was good. I was going to provide more detail than "strange error messages" in this post so I logged back in as my old account, expecting to be able to copy down exactly what it said, when all of a sudden the session starts with no problems! I don't know what to make of this, but it works now...or should I say, for now?

Scotty

Quote from: Jackabomb on January 21, 2012, 04:42:15 AM
Strange fact: I can sudo just fine using my own password, but I can't su. I wonder why. What is the difference between the two? I think I might just load my personal files onto the external drive, make a list of programs to reinstall that I use, then make a new VM using a new disk image...it wouldn't be hard to do, but I'd rather not. Just saying, it wouldn't be too hard to do. Either way, it looks like I'll need a new cd image. I'll go get one.


[EDIT] I have solved the problem by using the recovery console to reset the root password. A new problem arose that seems to have suddenly righted itself. When I tried to log in as a user again, I got several strange error messages and it froze before it loaded my session. To fix this, I logged as the root and created a new user called main that(hopefully) would be identical to my old account. I used adduser at least 12 times making sure I had all the groups right. Anyway, after copying all the files from the home directory into main's and using chmod, chown, and chgrp to make sure everything was good to go, I logged in as main. Everything was good. I was going to provide more detail than "strange error messages" in this post so I logged back in as my old account, expecting to be able to copy down exactly what it said, when all of a sudden the session starts with no problems! I don't know what to make of this, but it works now...or should I say, for now?

For the sudo su command, you might not be in the sudoers file.  Use vi/nano/emacs/text (sudo of course) editor to edit the file: /etc/sudoers.  At the bottom of the list where a commented line reads "# User privilege specification", beneath that add a line that reads: "user ALL=(ALL) ALL", replacing "user" with your user name. 

Not sure about your other issues, what you could try doing if you recall even a minute substring of the error is to browse through /var/log to search for it.  It'll likely be in dmesg, but you may have to dig around.  If you didn't catch a blip of text, you can try and search by timestamp (or dmesg's 24 hour format) to try and find it.  use `less` to open the files in the terminal for browsing ("q" to quit), or you can use zcat and pipe it to less to display older files that logrotate zips off every day (not sure when the error happened, if it was yesterday, go with dmesg.1.gz).