Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Changing the Root password

Posted on 2003-10-29
6
Medium Priority
?
1,041 Views
Last Modified: 2011-10-03
I have a linux computer in my department that has had the root password changed,
and I can not login.

How can I get the password changed.

If you could explain it by doing it at the computer level and if possible over the network  
0
Comment
Question by:CMILLER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 20

Expert Comment

by:Gns
ID: 9644923
Over the network? No. You could visit your local root-kit depot, but I'd recommend against any such thing;).

Hands on the HW? Yes, there might be several ways:
Mainly older distros might come with an "unprotected" singel user mode (usually runlevel 1, on systems with sysV init, s or singel might work with BSDish inits). In that case you simply reboot the machine (perhaps by a "double-kingston" (highlevel technical term from an era when "non-original" memory wasn't that reliable... means "button off->button on":-), and at the boot prompt enter either "1" or "singel" as a kernel commandline option (LILO: <bootlabel> 1<Enter>. Grub, you might have to "e"dit, or "a"ppend...). If you get prompted for the root password, you are out of luck with this method, else just do a passwd (or a passwd root) and you should be fine.
If that didn't work, the simplest thing is to boot some form of rescue mode (most distros have it on the install CD media), or some other linux (toms root&boot from http://www.toms.net/rb is a good floppy-linux, while knoppix (http://www.knoppix.net) is a very nice CD-selfcontained-linux). You need become root (if you arenät already) on that "rescue mode", then mount your on-disk linux "somewhere"... say /somewhere, then you need "chroot /somewhere", passwd ... and you're fine.
fdisk -l on the disk(s) will show what partitions you have... just mount the "Linux" or "Linux Native" ones, find the on-disk /etc/fstab, and you should be able to see what you need mount where (/ on /somewhere, /boot on /somewhere/boot, /usr on /somewhere/usr etc etc).

If you hadn't gathered it before, this is one of the reasons one should have good physical access protections to the server room (locks and alarms).

-- Glenn
0
 
LVL 7

Expert Comment

by:troopern
ID: 9644930
A simple way is to use a rescue disc or boot from installation cd and mount the system correctyl and then chroot to the environment and when thats done you can easilly change password with the command passwd
0
 
LVL 12

Expert Comment

by:paullamhkg
ID: 9646994
if the method of chroot don't work, boot up by using the knoppix as Gns suggest, try to mount the /etc and modify the /etc/shadow file as below
change the entry 'root:$1$ve.2WRaU$F8FZqVNwcgQftsnWCG5Ig0:12202:0:99999:7:::'  to 'root::12202:0:99999:7:::' this will remove the root password, so after you reboot the original linux, there will be no root password, after login as root (without the password) add the root password by 'passwd' or 'passwd root'.

ps before you edit/modify the /etc/shadow make a backup cp /etc/shadow /etc/shadow.bak will do, just in case anything go wrong, you still can go back to the original
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:CMILLER
ID: 9647055
Thanks, I will try all sug, I will be out of the office until monday next week, I will try then.
0
 

Author Comment

by:CMILLER
ID: 9723626
I downloaded KNOPPIX, booted up and su to root.

I did a fdisk -l and have

/dev/hda1 - boot
/dev/hda2
/dev/hda3 - swap

not sure how to mount hda2, I tried " #mount /dev/hda2/etc /
It will not mount
0
 
LVL 20

Accepted Solution

by:
Gns earned 500 total points
ID: 9730016
su
mount         #<- the mount command is to check that /dev/hda# hasn't been mounted already... If so, just umount <mountpint or device handle>
mkdir /tmp/hdroot
mount /dev/hda2 /tmp/hdroot
mount /dev/hda1 /tmp/hdroot/boot
chroot /tmp/hdroot
passwd
<password>
<password>
--- done ---
Just reboot and you should be able to log in...:)

-- Glenn
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question