how to recover mistakenly deleted root user line in /etc/passwd

view story

http://unix.stackexchange.com – I had an accident with /etc/passwd - using putpwent(), I replaced the first line of /etc/passwd with mine. Unfortunately this line used to belong to root. Now I don't have root permission, and I can't change it back. The file belongs to user 0 group root: -rw-r--r-- 1 0 root 1.8K Jan 9 11:33 passwd Any idea how to recover? (HowTos)