Mình muốn gán quyền tắt máy cho user mà không cần nhập mật khẩu của user root

huudinhsleepy

New member
** Cách cho phép người dùng Tatmay tắt hệ thống mà không cần nhập mật khẩu gốc **

**Vấn đề:**
Bạn đã tạo một người dùng có tên "TatMay" và đặt mật khẩu của họ thành "Shutdown123".Tuy nhiên, khi bạn đăng nhập làm tatmay và cố gắng tắt hệ thống, bạn sẽ được nhắc nhập mật khẩu gốc.

**Giải pháp:**
Để cho phép người dùng Tatmay tắt hệ thống mà không cần nhập mật khẩu gốc, bạn có thể sử dụng các bước sau:

1. Mở thiết bị đầu cuối.
2. Nhập lệnh sau:

`` `
sudo usermod -ag sudo tatmay
`` `

Điều này sẽ thêm người dùng Tatmay vào nhóm sudo.
3. Đăng xuất và đăng nhập lại dưới dạng Tatmay.
4. Cố gắng tắt hệ thống.Bạn không còn được nhắc về mật khẩu gốc.

** Mẹo thưởng: **
Bạn cũng có thể sử dụng lệnh sau để cho phép người dùng Tatmay tắt hệ thống mà không cần nhập mật khẩu gốc:

`` `
sudo chmod +s /sbin /tắt máy
`` `

Điều này sẽ cung cấp cho người dùng Tatmay khả năng chạy lệnh `shutdown` mà không cần đặc quyền gốc.
=======================================
**How to allow user Tatmay to shut down the system without entering the root password**

**Problem:**
You have created a user named "Tatmay" and set their password to "shutdown123". However, when you log in as Tatmay and try to shut down the system, you are prompted for the root password.

**Solution:**
To allow user Tatmay to shut down the system without entering the root password, you can use the following steps:

1. Open the terminal.
2. Type the following command:

```
sudo usermod -aG sudo tatmay
```

This will add the user Tatmay to the sudo group.
3. Log out and log back in as Tatmay.
4. Try to shut down the system. You should no longer be prompted for the root password.

**Bonus tip:**
You can also use the following command to allow user Tatmay to shut down the system without entering the root password:

```
sudo chmod +s /sbin/shutdown
```

This will give the user Tatmay the ability to run the `shutdown` command without root privileges.
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top