Changing the Linux root password
This post examines the various ways in which you can change the linux root password, if you foget it or may be just hack into a system that you have physical access to.
There are a couple of ways in which you can change the root password of a linux system, if you have forgotten it.
The efficacious and fast way of doing this is:-
1.Getting the shell in read write mode :-
- At the lilo prompt type " linux init=/bin/bash rw " without the quotes . Now what this does is, it gives us the bash shell (Bourne again shell) in read write mode and does not start with /sbin/init , /etc/rc.d/* and rc.local and so on and so forth routines.
- Now use the passwd command and type the new password for root but you should not restart the system yet as it can cause data crash.
- After you have changed the password, remount the partition in read only mode, this can be done by using the command " mount -o remount,ro / " without the quotes.
- Now you can reboot manually without the risk of loosing the data as the partition is in read only mode
The other way of doing it is also efficacious but it does take a step more and is really a oaf thing to do if you know the first way.
2. Getting the shell in read mode :-
- At the lilo prompt type "linux init=/bin/bash" . This does that same but gives us the bash shell in read mode.
- But we want it in read-write mode so that the changes can be written to the /etc/passwd and /etc/shadow file. So for that execute the command " mount -o remount,rw / " (without the quotes). This remounts the /(root partition) in read write mode.
- Now you can follow the steps 2 to 4 in the aforementioned solution for accomplishing the task.
The last and most dreaded way:-
3. Running the system at init runlevel 1:- This should be done with complete caution because even if you misplace a single letter or white-space while editing the kernel line in the boot menu, the system would give you the error that it cannot find the kernel and if you still want to follow this method then do so with utmost caution.
Note:Almost all the system administrators password protect the boot menu but in case it is not password protected then you can easily change the root password.
Just follow these steps:-
- If you are using a dual boot system, then you would be using Grub boot loader and at the start-up you would be given the time to select which os you want to boot to. Interrupt the normal boot process by pressing any key (except enter of course) and select the linux partition and press e (for editing the Grub boot option).
- The boot commands will be displayed to you, Select the command representing the linux kernel from the list. The line would be of the form "kernel /vmlinuz-...." and press e again to edit this line.
- Be careful in this step, for changing the boot process to init run-level 1 , type the space followed by 1 at the end of the line (after the /rhgb). This tells the system to run only the scripts of run-level 1 ie rc1.d (remember we by passed this in the first 2 solutions). Now just press b to continue the boot process which will leave you with a bare shell with #prompt.
- Type the passwd command, you will be asked to enter the new root password and after you confirm it, reboot the system.
- Now you can log into the system with the new root password that you entered in the previous step.
Nothing Found!
Why not submit your own content? Signup here.
-
How To Reset Your Password on Windows with the Help of a USB Flash Drive | By bombermanneo | in Computers
Forgot windows password? use a Flash Drive of 2 GB to recover windows password. Below are the steps to reset Window...
-
How to set up a quick simple & cheap extended range Wi-Fi Repeater | By backwoodstech | in Computers
This article will show you how to cheaply and fairly easily increase the Wi-Fi range and signal strength in situati...
-
How to Start Your Computer in Safe Mode, For Windows XP | By RockyHuber | in Computers
If you want to start your computer in safe mode for troubleshooting, removing spy ware and adware, and so-forth, fo...
-
How to Advance Your Computer Skills | By nikkisol | in Computers
Tips you can use to advance your computer skills....
-
Microsoft seriously develop intelligent computer | By Website | in Computers
Microsoft’s was ambition to continue do perform the lastest innovation and they’re going to be the leader in th...
-
Get 100 fps in counter strike1.6 | By morph | in Computer & Video Games
The guide which tells you how to configure your graphics card to get 100 fps in counter strike 1.6 and experience a...
-
What is GOD ? | By morph | in Religion
The self experience of some power that is omnipresent and all powerful...
-
Shell servers | By morph | in Computers
This provides a simple introduction to shell servers which are basically unix/linux system shells on which you can ...
-
Dual core processors: The main logic | By morph | in General
It explains the main working logic behind the dual core processors on why it delivers more performance at lower clo...
-
Google Search Operators | By morph | in General
This presentation acts like a consummate guide for using both basic and advanced search operators that can be used...








No comments yet.