Regaining root access "on a PBX that YOU OWN!"
Warning: It is ILLEGAL to do this on a machine that you do not own, this is intended only for hardware that you own. It is intended for people who are running a PBX system where they have either forgotten the password or were not supplied with it by their former system administrator.
(If you own the hardware, you should you know the password but if you don't for some reason!)
This was tested on the free version of switchvox.
Step 1 - (Using the well known Single User Mode to get a root prompt with GRUB).
- While booting into the PBX press 'e' as soon as the grub menu appears.
- Using the arrow keys, choose the line with your kernel. It will look something like "/boot/vmlinuz-2.6.24-23-rt root=/dev/sda1 ro"
- change the 'ro' to 'rw' then add ' single' to the and of the line. Then press 'enter'
The new line should look like "/boot/vmlinuz-2.6.24-23-rt root=/dev/sda1 rw single"
- Make sure the kernel line you modified is highlighted and press 'b' to boot the new line.
**IMPORTANT NOTE - As soon as your system is booting and you see the "press I for interactive" press "I" a few times. Soon you should be greeted by a bash prompt. If you get asked for the root password when entering single user mode use 'init=/bin/bash' on the kernel append line which should boot the machine into a bash console where you can get read/write access.
Step 2 - (You should be at your single user bash prompt with # next to the cursor)
- Try the command 'passwd' If simply using 'passwd' to change root doesn't work and you get an error then you will have to keep reading. If passwd successfully changed the root password then reboot and enjoy your new PBX system.
- (Assuming passwd did not work) - type 'adduser newuser' and set the password to newuser.
- Now CD into /etc and edit the passwd file or shadow file if you have one with 'vi /etc/passwd' or 'vi /etc/shadow' if you have a shadow file, that is where the encrypted password is kept.
- The newuser you created will have a line in /etc/shadow that looks like this;
newuser:$1$GTayGdXe$Nz/jvMC7SImVQCfMuPG.m1:14257:0:99999:7:::
Now just copy the string that exists between the first set of colons in your newuser and put it where the * or string is on the root line. Here are some examples.
Old root string - "root:*:14095:0:99999:7:::"
New root string - "root:$1$GTayGdXe$Nz/jvMC7SImVQCfMuPG.m1:14095:0:99999:7:::"
(Now Save the file)
Step 3 - Reboot the system and log in as root with the password you set for newuser.
That should work just dandy, you can now access your PBX using root!
Special thanks to Douglas for helping me understand how the passwd & shadow file work.
Cheers!
you saved my day. thanks man, very good explanation
ReplyDelete