After change /etc/passwd, sudo be not effect

Viewed 15

In my experiment, I change /etc/passwd like following.

Now the root user id be 1234, and I guess that is the reason which make all sudo command not effect.

I can not restore the /etc/passwd, because of lack writing permission.

Is there any solution ?

root:x:1234:1234:root:/root:/bin/bash
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin

PS. This enviroment is WSL2 archlinux. But I try using notepad with administrator permission, still cannot change the file. If there is a suitable method, please also let me know. Thanks.

0 Answers
Related