Firmware Backup without telnetd

From NAS-2000.org

Jump to: navigation, search

2.x versions of the firmware no longer include telnetd so you can't Enable_telnet so how to back up your firmware?

After some hacking I have a solution. Maybe I'm being retarded but I couldn't see an obvious way to back up the firmware without telnet.

The telnet service is still active if you look at "/etc/inetd.conf" on the NAS but there's no telnetd command installed DOH. You can, however, (queue evil laughter) just plonk any command you like in "/usr/sbin/telnetd" (on the NAS) and it will be executed when you telnet into your nas, cool huh? So here goes...

  1. I assume you've already formatted the disk so you have somewhere to save stuff.
  2. Log in to you NAS and select Control Panel -> Maintenance -> Save configuration.
  3. "tar -xf config.tar -C icyboxConfig" to extract the config to icyboxConfig directory.
  4. cd icyboxConfig
  5. edit etc/exports so that it contains this (so that you can nfs-mount the NAS's file system). <pre> / *(rw,no_root_squash) /mnt/IDE1 *(rw,no_root_squash) /system *(rw,no_root_squash) </pre>
  6. Now do "tar -cf ../configModified.tar ." assuming you're still in the icyboxConfig directory.
  7. Restore the modified config and wait whilst the NAS restarts.
  8. Now you can nfs mount stuff on you nas. ("cd .." to get out of icyboxConfig)
  9. Do "mkdir icybox" and mount stuff:-
    mount -t nfs <nasip>:/ icybox
    mount -t nfs <nasip>:/system icybox/system
    mount -t nfs <nasip>:/mnt/IDE1 icybox/mnt/IDE1
    
  10. Now then now then... You can now edit much of the file system on the NAS. I made a script called "icybox/usr/sbin/telnetd" as follows:
    #!/bin/sh
    #
    # Saves the firmware to disk.
    mkdir -p /mnt/IDE1/flash/dump/
    dd </dev/mtd0 >/mnt/IDE1/flash/dump/redboot.bin
    dd </dev/mtd1 >/mnt/IDE1/flash/dump/zImage
    dd </dev/mtd2 >/mnt/IDE1/flash/dump/rd.gz
    dd </dev/mtd3 >/mnt/IDE1/flash/dump/hddapp.tgz
    dd </dev/mtd4 >/mnt/IDE1/flash/dump/VCTL.bin
    dd </dev/mtd5 >/mnt/IDE1/flash/dump/curconf.tgz
    dd </dev/mtd6 >/mnt/IDE1/flash/dump/fid.dat
    

    You'll probably have to do "chmod +x icybox/usr/sbin/telnetd" to make it executable.

  11. Now telnet into you NAS. You should see the output from the script you just made (you can test it by echoing stuff I guess but it just worked for me so I've not bothered trying this).
  12. Now copy the firmware files that have magically appeared in icybox/mnt/IDE1/flash/dump off your nas for safe keeping!
  13. Finally unmount the NAS filesystem
    umount icybox/system
    umount icybox/mnt/IDE1
    umount icybox/
    

Perhaps you could just make a fake telnetd script that will launch an entire shell session so that you could run any commands you like on the NAS? I've not tried this though...

Disclaimer! I've not tried flashing these to check they really are sound but I have no reason to believe they won't work. YMMV etc. Does anyone have MD5 sums of the firmwares so we can check they're sane?

--Csimmons 22:49, 17 December 2008 (CET)

Personal tools