windows subsystem (WSL) root or user password forget how to modify?

Summarizes commonly used on the Internet in several ways:

(A method which has failed, because lxrun in win10 1709 after being abandoned version, Method II and Method four failed with me, so I personally was finally adopted Method Three)

 

First, start with administrator privileges PowerShell, enter lxrun / setdefaultuser root, open WSL, enter passwd root to change the password.

 

Second, open or PowerShell CMD, input ubuntu config --default-user root, modify the default user ubuntu the root, then open an input bash passwd root change the password.

Note:

Can enter lsb_release in bash -a view ubuntu version, according to others to say, need to enter the command version 18.04 is ubuntu1804 config --default-user root, kali version you need to enter is kali config --default-user root. You can also press the tab key after entering ub full complement should check their input is ubuntu or ubuntu1804 like.

My ubuntu is installed under the Legacy mode version 16.04, but the strange thing is that no matter what I input ubuntu or ubuntu1604, PowerShell show does not recognize, but a search of the tab to give me full instructions but could not find you want.

 

Third, in the directory C: \ Users \ AppData \ Local lxss rootfs user \ \ \ \ etc, locate the file called shadow, and open with notepad ++ like text viewer can see the root and all ordinary users, as well as through encrypted password. You can use a hash covered remember the password, you can also delete content directly between the first to the second colon after colon or root user name, and then open the bash will be able to directly enter passwd to set a new password. (Do not forget to backup operation before ~)

 

Fourth, the subsystem reset win10 (non-offloaded, Baidu reference)

However, I did not find the corresponding application within the application, and can not be reset by the CMD (as previously mentioned, is not recognized by ubuntu command).

Despite the doubts still very large, but the problem be solved, being the first without understanding it -

 

reference:

1. "WSL since Win10 1709"

https://www.douban.com/note/645961103/

2. "win10 subsystem in ubuntu forget the root password if you modify? "

https://social.technet.microsoft.com/Forums/SECURITY/en-US/3816c875-7c48-4620-82b6-31d5547f1076/

3. "win ubuntu after subsystems forget your password."

https://blog.csdn.net/qq2588258/article/details/100932334

4. "Modify Wsl to root login, and change the root password."

https://blog.csdn.net/zcy_wxy/article/details/103621808

Guess you like

Origin www.cnblogs.com/victorique-de-blois/p/12339989.html