Root entry in /etc/passwd

Hello,
I accidentally damaged the first line in my /etc/passwd instead of
root:x:0:0:root:/root:/bin/bash

it now reads
\root:x:0:0:root:/root:/bin/bash

this results in the root account being not accessible, hence not possible to just edit the file using root privileges.

is there a way to repair this?

That’s very very bad! :stuck_out_tongue: Backup the “/etc/passwd” then try below if it works. I haven’t tried, this just came to my mind:

su www-data -c"sed -i 's/\\\root/root/' /etc/passwd"; Edited: see 4th post.

Hope your shadow file still intact.

Nah, thanks for the reply

it didn’t work :-/

since I have not too much data on it, do you think a factory reset would work?

Erm correction try below:

su www-data -c"sudo sed -i 's/\\\root/root/' /etc/passwd";

If it still doesn’t work, you could try the factory reset (40secs red reset button), this will not wipe your data but all settings/users/shares will get reset.

Yeah,
Thanks for the reply :slightly_smiling:

I did a 40 s. button reset before I tried the new suggestion, so am unable to confirm if it would’ve worked.
The 40sReset did work, no data was lost, just had to configure everything from scratch.

Thank you once again for the help!