Repair broken /etc/passwd on QNAP TS-409

7 December 2010 23:10

So, I was messing around with PS1 prompts on my QNAP TS-409 Pro and decided to add it into the .bash_profile. The shell wasn’t BASH so I edited the /etc/passwd to change it, however in my haste I hit save and quit with the shell being /etc/bas – missing an h.

The result is you cannot login via SSH. As only the admin user can login remotely this is a bit of an issue.

A lot of frantic Googling led me to a post on the QNAP forum with a guide on how to fix it. I’m going to repeat these steps here as well with my modifications. I have a 4 disk RAID5 and what I noticed was that when I hot plugged all 4 drives back in the array rebuilt itself and basically kicked me off again.

— Shutdown the system and remove all drives
— Boot, login using telnet to port 13131 (ensure you enable this via the web ui before shutdown)
— Hot plug 3 of the 4 drives (assuming RAID5)
— Assemble the system RAID partition:

# mdadm -A /dev/md9 /dev/sda1 /dev/sdb1 /dev/sdc1 --run
# mkdir /mnt/HDA_ROOT
# mount /dev/md9 /mnt/HDA_ROOT
# cd /mnt/HDA_ROOT/.config

— edit the passwd file and correct any mistakes

# halt (shuts the unit down)

— plug in 4th drive
— power up

Turns out I hadn’t noticed the .profile file which I could have changed and saved a world of pain!

Filed: Technology // Tagged: , , ,

You can follow any responses to this entry through the RSS 2.0 feed.

You can leave a comment or leave a trackback from your own site.

3 Responses to “Repair broken /etc/passwd on QNAP TS-409”

  1. Jay Goldberg on August 23rd, 2012 at 9:26 pm

    May I add this to the QNAPedia?

  2. Ian on October 21st, 2012 at 9:41 pm

    Sure, no problem.

  3. qnapuser on September 22nd, 2013 at 2:43 pm

    Thx for this information. I was also stupid to damage the passwd, but with this information i solved the problem. Many thx.

Leave a Reply

What's ianteresting?   •   Twitter   •   About   •   Contact
©2015 Ian Winter. All Rights Reserved.   •   Powered by WordPress   •   Hosted at Memset