Hello. I forgot ssh root password on my MyPBX U520.
I want to reset in by editing the /etc/passwd file.
How do i do it? Can i interrupt boot of Linux system and edit the boot point (like GRUB's e)?
Or i need other ARMv71 distro to boot from (arch linux arm via usb or something like that)? Please help!
5 comments
-
Oscar Colka KiryII, if you have a console cable, you can connect the console cable and enter the uboot interface by press any key at the very beginning, but I think it is not possible to edit the boot point. Also, I think the best way to reset the root password is reset the device back to factory default.
-
Kiryll Problem solved. Scroll the page further for the guide.
i inspired from http://help.endian.com/hc/en-us/articles/218146638
and http://gumstix.8.x6.nabble.com/Booting-into-single-user-mode-under-U-Boot-td650730.html
and http://u-boot.10912.n7.nabble.com/U-Boot-change-root-password-td70705.html -
Kiryll Problem solved. Scroll further for the guide.
-
Kiryll OK, i figured it out!
So, here is the guide:
1. Power on your MyPBX U520 device, with Putty connected to console (baud rate 57600)2. As soon your device got power, press any key several times to interrupt the boot process of device and get to the u-boot prompt, in my case it was
pbx300>
3. Enter the printenv command to get the u-boot constant values.
4. You should see this type of output:
bootdelay=1
baudrate=57600
autoload=no
verify=yes
loadaddr=0x81000000
ipaddr=192.168.5.52
update-sf=tftp 0x88000000 u-boot.spi;sf probe 0;sf erase 0 0x40000;sf write 0x88000000 0 ${filesize}
bootargs=console=tty01,57600n8 rw mem=768M root=/dev/ram
ramboot=run nandboot1;run nandboot2;run tftp-boot...
and other output5. Now you need the bootargs row. Copy the bootargs value.
6. Set the boot arguments to boot the single user mode.
For this, enter this command:
setenv bootargs 'paste your bootargs + keyword single'For me it was like this:
pbx300>setenv bootargs 'console=tty01,57600n8 rw mem=768M root=/dev/ram single'
BE VERY CAREFULL AND DONT COPY FROM HERE, YOU CAN HAVE DIFFERENT VALUES IN YOUR BOOTARGS ROW!
Changes made by setenv are lost after reboot!
7. After you set the new boot arguments, you can process to boot into the system.
If you will enter the saveenv command, you will save the current configured bootargs, and will enter single mode every time after reboot, so DONT saveenv!8. Enter the boot command to boot with configured single mode.
9. You should boot in the system with the @(none):/# prompt.
10. Type /dev/ and press Tab twice. You should get the list of devices. You are interested in mtdblock2 device. This is the NAND memory the PBX normally boots from.
11. Create temporary mount point, using this command:
@(none):/# mkdir /mnt/temp
12. After mount point was created, mount mtdblock2 device to your running system, like that:
@(none):/# mount -t yaffs2 /dev/mtdblock2 /mnt/temp
-t yaffs2 = indicates that mounted device has YetAnotherFlashFileSystem
13. Now access memory through mount point.
@(none):/# cd /mnt/temp
Enter ls command and check if there is present /etc directory. If yes, cd into it
@(none):/mnt/temp# cd ./etc/
14. ls again, you should find passwd file.
15. Now you are going to purge the forgotten root password. For this you need to edit the passwd file, where all password are saved in encrypted form.
Check your prompt, it indicates that you are int the etc directory:
@(none):/mnt/temp/etc#
Open passwd file using 'vi' text editor
@(none):/mnt/temp/etc# vi passwd
See the row (in my case):
root:m*&y32yu48&*(u4yh3r43^yio.t/fvGaz:0:0:root:/:/bin/sh
The random bunch of letters and characters
m*&y32yu48&*(u4yh3r43^yio.t/fvGaz
is the encrypted password.
CAREFULLY DELETE it, so you get the following row:root::0:0:root:/:/bin/sh
15. Enter :wq command to save and exit from the editor. Enter vi passwd command again and check if anything is ok and password is purged. Enter the :q command to just exit the vi text editor.
16. Enter the reboot command. Now your PBX will boot in normal way, because after reboot your setenv settings will be lost, because these was not saved with the saveenv command. However, root password is purged now.
17. After PBX boots up and login as: prompt apperas, try to login as root. When the password prompt will appear, just hit ENTER.
You should be able to log in console with root privileges. Now enter passwd command and enter the new password.
That's all. Be careful and don't forget your passwords, like i did, haha! :D
-
Oscar Colka Great Job! Cool Man!