How to Gain Root Access
Today I’m going to talk about how to gain root access to Linux, or to any other Unix-like operating system. First of all, before digging too deeply into things, let me explain what root access actually means (did you catch that play on words? Man, I’m good!). Anyhoo, root is a login account, which has been given full and complete access to all system resources. Root access is access to everything. Root also goes by the name, "Superuser," a term I definitely prefer. The Superuser is the God of the operating system (I like this term, too - feel free to address me as either one). Your average Joe should kneel down to and worship the Superuser (yes, I’m talking to you, Joe from tech support). The Superuser is also the one user who can delete the entire operating system using one simple command.
Scary, huh? But God-like, too.
Okay, let’s go over the basics first. How does one become a Superuser? Well, you can either log into the system as root or type "su" in a normal user’s login session. Keep in mind that the root password is required in both instances. What if you don’t have the root password? Is it still possible to become root (without being a plant)? Keep reading and I’ll answer that very well thought out and intelligent question (that I made up myself).
Why would anyone want to become root (other than the whole power thing)? It’s quite simple, really. Because there are a lot of operations on Linux that are locked down tightly and cannot be touched under any other user. Of course, you could always make the argument for using the sudo command (not to be confused with the pseudo command, which is completely fake, BTW). If you made that particular argument, I’m afraid I would have to say to you, "Sit down, Poindexter!" By making this assertion you are going under the assumption that sudo is actually on your system (Debian does not have this as a base install) and that you have been added to the /etc/sudoers file by the root user (or another user that is in the /etc/sudoers file).
So is there any other way to become root? What if the only person that knew the root password at your organization got hit by a bus? No, Phil is fine - he didn’t actually get hit by a bus. It was a moped. But still, he’s unconscious. What do you do? Or, what if you forgot the root password to a system you have not booted in 3 years? Well, my friend, I have a few tricks up my sleeve for you to try. If the system is locked down tightly, there’s no hope for you. But if not, then give these a go, mate!
How to modify kernel boot-up arguments to gain root user access:
1. Boot-up the computer2. If the GRUB menu is hidden, press Esc to enter the GRUB menu
3. If the GRUB password is set, press p to unlock the GRUB menu
4. Select the Kernel of your choosing using the arrow keys
5. Press e to edit the commands before booting
6. Select kernel /boot/vmlinuz-2.x.xx.xx root=/dev/hda2 ro quiet splash (this line will look different on your system)
7. Press e to edit the selected command in the boot sequence
8. Add rw init=/bin/bash to the end of the line
grub edit> kernel /boot/vmlinuz-2.x.xx.xx root=/dev/hda2 ro quiet splash rw init=/bin/bash
9. Press b to boot
10. If you are successful, you will now be logged in as root
How to use a Live CD to gain root user access:
1. Boot-up computer into the Live Installation CD (like the Ubuntu Live CD)
2. At the “boot:” prompt, add “rescue” to the argument
boot: rescue
3. Follow the instructions on the screen
4. If you are successful, you will now have root access
How to gain root user access if you were granted sudo access:
1. Go to the command line
2. Type sudo vi
3. When prompted, type in your password (yes, yours…not roots)
4. Once in vi, you press the colon key - the one that makes this symbol, : - then type in "shell" and press return
5. You will now be out of vi, but you will be the root user.
In sum, I have given you three ways to can gain root access that have worked well for me. There are a few others, but if I tell you what they are, I’ll have to kill you. Sometimes these tricks can come in handy. Other times, not so much. The previous root user, if they are smart, may have plugged up all the holes in their system. If they are not, then there’s hope yet!
As a final note, here at Gorkee we like to say, "We know stuff." Well, it might come as a surprise to you, but we have opinions about stuff, too. Come check out our new Online Shop featuring products that we love or would love to have. Our pick of the week: A must-have book on OS Security and Hacking. We also have other excellent products you can take a look at, all reviewed by a member of the Gorkee team.
Until next time…Viva la Linux!

Articles 





