Cách đặt lại mật khẩu Linux trên WSL

ngonhuhaithao

New member
#Reset #linux #password #WSL #LinuxWSL

## Cách đặt lại mật khẩu Linux trên WSL

Hệ thống con Windows cho Linux (WSL) là một công cụ mạnh mẽ cho phép bạn chạy Linux trên Windows.Tuy nhiên, nếu bạn quên mật khẩu Linux của mình, bạn có thể bị khóa khỏi thể hiện WSL của mình.May mắn thay, có một vài cách để đặt lại mật khẩu Linux của bạn trên WSL.

### 1. Sử dụng lệnh passwd

Cách dễ nhất để đặt lại mật khẩu Linux của bạn là sử dụng lệnh `passwd`.Để làm điều này, hãy mở một thiết bị đầu cuối PowerShell và chạy lệnh sau:

`` `
passwd <Susername>
`` `

trong đó `<Susername>` là tên người dùng của tài khoản có mật khẩu bạn muốn đặt lại.

Bạn sẽ được nhắc nhập mật khẩu mới của mình hai lần.Khi bạn đã nhập mật khẩu mới của mình, bạn sẽ có thể đăng nhập vào phiên bản WSL của mình bằng mật khẩu mới.

### 2. Sử dụng lệnh CHPASSWD

Bạn cũng có thể sử dụng lệnh `chpasswd` để đặt lại mật khẩu linux của mình.Để làm điều này, hãy mở một thiết bị đầu cuối PowerShell và chạy lệnh sau:

`` `
Chasswd -e <Username>
`` `

trong đó `<Susername>` là tên người dùng của tài khoản có mật khẩu bạn muốn đặt lại.

Lệnh này sẽ mã hóa mật khẩu mới của bạn và lưu trữ nó trong tệp `/etc/shadow`.Sau đó, bạn sẽ có thể đăng nhập vào phiên bản WSL của mình bằng mật khẩu mới.

### 3. Sử dụng công cụ đặt lại mật khẩu

Nếu bạn không thể sử dụng các lệnh `passwd` hoặc` CHPASSWD`, bạn có thể sử dụng công cụ đặt lại mật khẩu để đặt lại mật khẩu Linux của mình.Để làm điều này, hãy mở một thiết bị đầu cuối PowerShell và chạy lệnh sau:

`` `
wsl reset-password <username>
`` `

trong đó `<Susername>` là tên người dùng của tài khoản có mật khẩu bạn muốn đặt lại.

Lệnh này sẽ mở một công cụ đồ họa cho phép bạn đặt lại mật khẩu Linux của mình.

### 4. Sử dụng bảng điều khiển khôi phục

Nếu bạn không thể truy cập phiên bản WSL của mình, bạn có thể sử dụng bảng điều khiển khôi phục để đặt lại mật khẩu Linux của mình.Để làm điều này, hãy làm theo các bước sau:

1. Khởi động máy tính của bạn vào chế độ khôi phục.
2. Chọn tùy chọn ** Khắc phục sự cố **.
3. Chọn tùy chọn ** Tùy chọn nâng cao **.
4. Chọn tùy chọn Dấu nhắc lệnh ** **.
5. Tại dấu nhắc lệnh, chạy lệnh sau:

`` `
passwd <Susername>
`` `

trong đó `<Susername>` là tên người dùng của tài khoản có mật khẩu bạn muốn đặt lại.

Bạn sẽ được nhắc nhập mật khẩu mới của mình hai lần.Khi bạn đã nhập mật khẩu mới của mình, bạn sẽ có thể đăng nhập vào phiên bản WSL của mình bằng mật khẩu mới.

### 5. Sử dụng ổ USB Linux có thể khởi động

Nếu bạn không thể truy cập phiên bản WSL của mình và bạn không có quyền truy cập vào bảng điều khiển khôi phục, bạn có thể sử dụng ổ USB Linux có thể khởi động để đặt lại mật khẩu Linux của mình.Để làm điều này, hãy làm theo các bước sau:

1. Tạo ổ USB Linux có thể khởi động.
2. Khởi động máy tính của bạn từ ổ USB.
3. Khi bạn được khởi động vào Linux, hãy mở một cửa sổ đầu cuối.
4. Tại thiết bị đầu cuối, hãy chạy lệnh sau:

`` `
passwd <Susername>
`` `

trong đó `<Susername>` là tên người dùng của tài khoản có mật khẩu bạn muốn đặt lại.

Bạn sẽ được nhắc nhập mật khẩu mới của mình hai lần.Khi bạn đã nhập mật khẩu mới của mình, bạn sẽ có thể đăng nhập vào phiên bản WSL của mình bằng mật khẩu mới.

## 5 hashtags

* #linux
* #WSL
* #Mật khẩu
* #Cài lại
* #Làm cách nào để
=======================================
#Reset #linux #password #WSL #LinuxWSL

## How to Reset Linux Password on WSL

Windows Subsystem for Linux (WSL) is a powerful tool that allows you to run Linux on Windows. However, if you forget your Linux password, you may be locked out of your WSL instance. Fortunately, there are a few ways to reset your Linux password on WSL.

### 1. Use the passwd command

The easiest way to reset your Linux password is to use the `passwd` command. To do this, open a PowerShell terminal and run the following command:

```
passwd <username>
```

where `<username>` is the username of the account whose password you want to reset.

You will be prompted to enter your new password twice. Once you have entered your new password, you will be able to log in to your WSL instance using the new password.

### 2. Use the chpasswd command

You can also use the `chpasswd` command to reset your Linux password. To do this, open a PowerShell terminal and run the following command:

```
chpasswd -e <username>
```

where `<username>` is the username of the account whose password you want to reset.

This command will encrypt your new password and store it in the `/etc/shadow` file. You will then be able to log in to your WSL instance using the new password.

### 3. Use the reset password tool

If you are unable to use the `passwd` or `chpasswd` commands, you can use the reset password tool to reset your Linux password. To do this, open a PowerShell terminal and run the following command:

```
wsl reset-password <username>
```

where `<username>` is the username of the account whose password you want to reset.

This command will open a graphical tool that will allow you to reset your Linux password.

### 4. Use the recovery console

If you are unable to access your WSL instance, you can use the recovery console to reset your Linux password. To do this, follow these steps:

1. Boot your computer into recovery mode.
2. Select the **Troubleshoot** option.
3. Select the **Advanced options** option.
4. Select the **Command Prompt** option.
5. At the command prompt, run the following command:

```
passwd <username>
```

where `<username>` is the username of the account whose password you want to reset.

You will be prompted to enter your new password twice. Once you have entered your new password, you will be able to log in to your WSL instance using the new password.

### 5. Use a bootable Linux USB drive

If you are unable to access your WSL instance and you do not have access to the recovery console, you can use a bootable Linux USB drive to reset your Linux password. To do this, follow these steps:

1. Create a bootable Linux USB drive.
2. Boot your computer from the USB drive.
3. Once you are booted into Linux, open a terminal window.
4. At the terminal, run the following command:

```
passwd <username>
```

where `<username>` is the username of the account whose password you want to reset.

You will be prompted to enter your new password twice. Once you have entered your new password, you will be able to log in to your WSL instance using the new password.

## 5 Hashtags

* #linux
* #WSL
* #password
* #Reset
* #howto
 
Join ToolsKiemTrieuDoGroup
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock