1: First, if you are using ubuntu of window stores of window11, first open a command window,
enter:
ubuntu2204 config --default-user root
This will switch to root login
2: Open ubuntu2204 of wsl2, now you are the root user of root, here you can reset your user password
As follows: passwd xxxx (username); later you can reset your user password
3: Switch to normal user again
ubuntu2204 config --default-user 普通用户名
Then you open the ubuntu of wsl2, which is the authority of ordinary users. You can use sudo to perform operations with root privileges
Note: ubuntu2204 is the system name plus version number