Bí Quyết Khôi Phục Mật Khẩu Root Linux: Hướng Dẫn Chi Tiết và An Toàn

Tiếng Việt

Trong quá trình sử dụng hệ điều hành Linux, đôi khi bạn có thể quên mật khẩu root. Đây là một vấn đề nghiêm trọng vì root là người dùng có quyền truy cập cao nhất vào hệ thống. Nếu bạn quên mật khẩu root, bạn sẽ không thể thực hiện bất kỳ thay đổi nào đối với hệ thống, bao gồm cả việc khôi phục mật khẩu.

Trong bài viết này, mình sẽ hướng dẫn bạn cách khôi phục mật khẩu root Linux một cách chi tiết và an toàn.

Các bước thực hiện

Có hai cách chính để khôi phục mật khẩu root Linux:

Sử dụng lệnh passwd

Sử dụng công cụ chroot

Sử dụng lệnh passwd

Đây là cách khôi phục mật khẩu root Linux đơn giản nhất. Tuy nhiên, cách này chỉ hoạt động nếu bạn vẫn có quyền truy cập vào tài khoản người dùng có quyền sudo.

Các bước thực hiện:

Mở một terminal và đăng nhập vào tài khoản người dùng có quyền sudo.

Chạy lệnh sau để thay đổi mật khẩu root:

passwd root

Nhập mật khẩu mới cho root và xác nhận mật khẩu.

Sử dụng công cụ chroot

Cách này an toàn hơn cách sử dụng lệnh passwd vì bạn sẽ không cần truy cập vào tài khoản người dùng có quyền sudo.

Các bước thực hiện:

Tắt máy tính hoặc VPS.

Khởi động lại máy tính hoặc VPS và giữ phím Shift.

Trong trình tải khởi động, chọn tùy chọn Advanced options.

Chọn tùy chọn Ubuntu with command-line interface.

Nhấn Enter để khởi động máy tính hoặc VPS ở chế độ command-line interface.

Chạy lệnh sau để thay đổi mật khẩu root:

chroot /mnt

passwd root

Nhập mật khẩu mới cho root và xác nhận mật khẩu.

Thoát khỏi chế độ command-line interface bằng cách chạy lệnh exit.

Khởi động lại máy tính hoặc VPS.

Lưu ý

Bạn nên thay đổi mật khẩu root thường xuyên để tăng cường bảo mật hệ thống.

Bạn nên lưu mật khẩu root ở một nơi an toàn để tránh bị quên.

Tiếng Anh

How to Recover Root Password in Linux

In the process of using the Linux operating system, you may sometimes forget the root password. This is a serious problem because root is the user with the highest level of access to the system. If you forget the root password, you will not be able to make any changes to the system, including recovering the password.

In this article, I will show you how to recover the root password in Linux in a detailed and secure way.

Steps

There are two main ways to recover the root password in Linux:

Use the passwd command

Use the chroot tool

Using the passwd command

This is the simplest way to recover the root password in Linux. However, this method only works if you still have access to a user account with sudo privileges.

Steps:

Open a terminal and log in to a user account with sudo privileges.

Run the following command to change the root password:

passwd root

Enter the new password for root and confirm the password.

Using the chroot tool

This method is more secure than using the passwd command because you will not need to access a user account with sudo privileges.

Steps:

Turn off the computer or VPS.

Restart the computer or VPS and hold down the Shift key.

In the boot loader, select the Advanced options option.

Select the Ubuntu with command-line interface option.

Press Enter to boot the computer or VPS in command-line interface mode.

Run the following command to change the root password:

chroot /mnt

passwd root

Enter the new password for root and confirm the password.

Exit the command-line interface mode by running the exit command.

Restart the computer

Bí Quyết Khôi Phục Mật Khẩu Root Linux: Hướng Dẫn Chi Tiết và An Toàn

Leave a Reply

All in one