LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-29-2009, 04:47 AM   #1
jacqui@datanet-sa.co.za
LQ Newbie
 
Registered: Jul 2009
Posts: 2

Rep: Reputation: 0
How do I get passed Administrator Password


Hi,

I am BRAND NEW to linux. I studied XHTML, PHP and MySQL in 2007 and had a guy set up a linux machine for me with an IP Address to act as a server for the database that I wanted to run.

Unfortunately he died in a car accident last year on the easter weekend. Since then we just stored the linux machine and cancelled the IP Address. It has gathered dust since then.

I have now finally put the machine on and logged on as a user which he created for me. But I need to log on as the administrator if I am to connect it to our network.

Thanx for your time,

Jacqui
 
Old 07-29-2009, 04:54 AM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by jacqui@datanet-sa.co.za View Post
I am BRAND NEW to linux. I studied XHTML, PHP and MySQL in 2007 and had a guy set up a linux machine for me with an IP Address to act as a server for the database that I wanted to run.

Unfortunately he died in a car accident last year on the easter weekend. Since then we just stored the linux machine and cancelled the IP Address. It has gathered dust since then.

I have now finally put the machine on and logged on as a user which he created for me. But I need to log on as the administrator if I am to connect it to our network.
You'll need to boot into single user mode.

That said, have you considered doing a fresh GNU/Linux installation?

Last edited by win32sux; 07-29-2009 at 04:57 AM.
 
Old 07-29-2009, 04:59 AM   #3
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

These procedures work for Debian, most likely also for other distributions although some commands or paths might be different, depending your distro.

“I forgot the root password!” (1)

It is possible to boot a system and log on to the root account without knowing the root password as long as one has access to the console keyboard. (This assumes there are no password requests from the BIOS or from a boot loader such as lilo that would prevent one from booting the system.)

This is a procedure which requires no external boot disks and no change in BIOS boot settings. Here, “Linux” is the label for booting the Linux kernel in the default Debian install. At the lilo boot screen, as soon as boot: appears (you must press a shift key at this point on some systems to prevent automatic booting and when lilo uses the framebuffer you have to press TAB to see the options you type), enter:

boot: Linux init=/bin/sh

This causes the system to boot the kernel and run /bin/sh instead of its standard init. Now you have gained root privileges and a root shell. Since / is currently mounted read-only and many disk partitions have not been mounted yet, you must do the following to have a reasonably functioning system.

# mount -n -o remount,rw /
# mount -avt nonfs,noproc,nosmbfs
# cd /etc
# vi passwd
# vi shadow

(If the second data field in /etc/passwd is “x” for every username, your system uses shadow passwords, and you must edit /etc/shadow.) To disable the root password, edit the second data field in the password file so that it is empty. Now the system can be rebooted and you can log on as root without a password. When booting into runlevel 1, Debian (at least after Potato) requires a password, which some older distributions did not.

“I forgot the root password!” (2)

Boot from any emergency boot/root disk set. If /dev/hda3 is the original root partition, the following will let one edit the password file just as easily as the above.

# mkdir fixit
# mount /dev/hda3 fixit
# cd fixit/etc
# vi shadow
# vi passwd

The advantage of this approach over the previous method is one does not need to know the lilo password (if any). But to use it one must be able to access the BIOS setup to allow the system to boot from floppy disk or CD, if that is not already set.

Restore deleted critical files such as /etc/passwd

Debian stores backups of critical files such as passwd, shadow, aptitude config files, … on a regular basis in /var/backups. If you accidentally delete one of these files you can copy them back to the original location. After doing so you might need to reset the permissions on the files to 644.

Kind regards,

Eric
 
Old 07-29-2009, 05:00 AM   #4
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Welcome to LQ.

There are some ways to become the administrator (a.k.a root) under linux. The first thing i would try is the sudo command. sudo allows you to run commands as another user. So to become the root user issue this on the command line
Code:
sudo su
The su commands porpuse is to become the root user. The sudo command will surely ask you or a password. Just use your password.

If this does not work you can see if it does by looking at the last part of the prompt on the command line. It should read a '#' at the end (Normal users have a $ at the end) you have to go the long route.

Get your self a Linux CD or DVD or USB. Just something you can boot of into linux. Mount your root partition and do a chroot into the mount point. This is a very brief explanation. It just depends to much on the devices you have and your these are partition. So if the first approach does not work. Just check back and I'll provide further assistence.
Some infos I would need for this. Execute after you boot up from external media and have a command line ready

Code:
fdisk -l
ls /dev
fdisk should be enough.

Regards Zhjim
 
Old 07-29-2009, 05:02 AM   #5
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Damn to slow

win32sux idea is by far the easiest. With grub installed also applicable if no boot entry is there. Just add the word "single" to the kernel command.
 
Old 07-29-2009, 05:13 AM   #6
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
EricTRA, please give credit where credit is due when you copy other people's works.

Last edited by win32sux; 07-29-2009 at 05:25 AM.
 
Old 07-29-2009, 06:09 AM   #7
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
Another thing to consider: if he didn't set you up with "sudo", he might have just made root the same as YOUR password.

Otherwise, Google for "lost root password".
 
Old 07-29-2009, 06:15 AM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by win32sux View Post
EricTRA, please give credit where credit is due when you copy other people's works.
Hi win32sux,

Not trying to get credit for someone else's work, just had this lying around in a txt document without even remembering where I got it. Sorry if copy/paste offends you. If we have to provide a reference link for all the item's we copy from other sites wouldn't our post be twice as large and thus more time consuming both in posting and in reading?

Kind regards,

Eric
 
Old 07-29-2009, 03:15 PM   #9
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by EricTRA View Post
Not trying to get credit for someone else's work, just had this lying around in a txt document without even remembering where I got it.
Well, then you could have at the very least mentioned that in your post.

Quote:
Sorry if copy/paste offends you. If we have to provide a reference link for all the item's we copy from other sites wouldn't our post be twice as large and thus more time consuming both in posting and in reading?
Copy/paste doesn't offend me. Plagiarism, on the other hand, is a really nasty habit.

And no, posting a reference link doesn't make your post twice as large. It can indeed add a few seconds to the total time it takes you to create your post, but it's the right thing to do.
 
Old 07-30-2009, 02:17 AM   #10
jacqui@datanet-sa.co.za
LQ Newbie
 
Registered: Jul 2009
Posts: 2

Original Poster
Rep: Reputation: 0
linuxgazette.net

Quote:
Originally Posted by pcunix View Post
Another thing to consider: if he didn't set you up with "sudo", he might have just made root the same as YOUR password.

Otherwise, Google for "lost root password".
Hi,

Thank-you. I googled the "lost root password" and came up with linuxgazette.net. This helped. Pretty much did what Eric's copy and paste says. But this one is much simpler. I only used

single init=/bin/bash
passwd
reboot

It worked.

Thanx ALL for your help!
 
Old 07-31-2009, 01:40 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
And reinforcing post #2, if it hasn't been used for over a year, it definitely needs updating if not upgrading.
Which distro and version is it?
 
Old 07-31-2009, 07:05 PM   #12
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
This looks like the source of post#3.
http://www.goitexpert.com/general/ho...inux-password/

I inserted a unique looking phrase in google, enclosed in double quotes, to find the source.
"you must press a shift key at this point on some systems to prevent automatic booting"

Last edited by jschiwal; 07-31-2009 at 07:06 PM.
 
Old 07-31-2009, 09:33 PM   #13
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by jschiwal View Post
This looks like the source of post#3.
http://www.goitexpert.com/general/ho...inux-password/

I inserted a unique looking phrase in google, enclosed in double quotes, to find the source.
"you must press a shift key at this point on some systems to prevent automatic booting"
No, the original source appears to be the Debian reference which I linked above. What you've linked looks like just another blog which plagiarized it. That said, we've moved beyond this already, so let's try and stay focused on the OP instead.
 
  


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
[ssmtp] password is passed in blank if it contains '#' davidshen84 Linux - Software 0 02-10-2009 07:25 PM
forgot winxp administrator password for IPC$ share purpose. hocheetiong Linux - Security 2 12-19-2007 11:05 AM
Linspire 5.0 Administrator Password Doesn't Work SerenityTax Linux - Newbie 2 10-19-2007 05:11 AM
Using C API; first query passed passed by program to MySQL is successful, second quer weibullguy Programming 2 06-12-2007 10:45 PM
Administrator Password ajkannan83 General 2 04-21-2006 09:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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