Mở policy để truy cập từ máy tính mạng LAN
Phương Án A
Dưới đây là hình ảnh hướng dẫn trực quan từng bước để bạn dễ dàng mở policy truy cập từ các máy tính trong mạng LAN qua Local Security Policy:
-
Bước 1: Nhấn tổ hợp phím Windows + R ➔ Gõ secpol.msc ➔ Nhấn Enter.
-
Bước 2: Điều hướng theo đường dẫn: Security Settings > Local Policies > User Rights Assignment.
-
Bước 3: Tìm chính sách Access this computer from the network ➔ Nhấp đúp ➔ Chọn Add User or Group... ➔ Thêm Everyone hoặc Users ➔ Nhấn OK.
-
Bước 4: Kiểm tra chính sách Deny access to this computer from the network ➔ Nhấp đúp ➔ Nếu thấy tài khoản muốn cấp quyền (như Guest, Users) bị chặn thì chọn và nhấn Remove.
-
Bước 5: Mở Command Prompt (CMD) với quyền Admin và gõ lệnh gpupdate /force để hệ thống cập nhật thay đổi ngay lập tức.
Chúc bạn thực hiện thành công! Nếu gặp khó khăn ở bước nào, hãy cho tôi biết nhé.
Phương Án B
File Script cấu hình tự động: CauHinhLAN_Scan.bat
Anh tạo một file văn bản mới, đổi tên thành CauHinhLAN_Scan.bat, nhấp chuột phải chọn Edit (hoặc mở bằng Notepad) và dán toàn bộ nội dung bên dưới vào:
DOS
@echo off
:: Kiem tra quyen Administrator
net session >nul 2>&1
if %errorLevel% neq 0 (
echo [LOI] Vui long nhap chuot phai vao file nay va chon 'Run as administrator'!
pause
exit /b
)
echo Dang cau hinh User Rights Assignment cho user "scan"...
:: 1. Xuat cau hinh bao mat hien tai ra file tam
secedit /export /cfg "%temp%\sec_config.inf" /areas USER_RIGHTS >nul
:: 2. Xu ly policy SeNetworkLogonRight (Access this computer from the network)
findstr /i "SeNetworkLogonRight" "%temp%\sec_config.inf" >nul
if %errorLevel% equ 0 (
powershell -Command "$f='%temp%\sec_config.inf'; $txt = Get-Content $f -Raw; if ($txt -notmatch '(?m)^SeNetworkLogonRight.*scan') { $txt = $txt -replace '(?m)^(SeNetworkLogonRight\s*=.*)', '$1,scan'; Set-Content $f $txt }"
) else (
echo SeNetworkLogonRight = scan,Everyone >> "%temp%\sec_config.inf"
)
:: 3. Loai bo "scan" khoi SeDenyNetworkLogonRight (Deny access from the network) neu bi chan
powershell -Command "$f='%temp%\sec_config.inf'; (Get-Content $f) | ForEach-Object { if ($_ -match '^SeDenyNetworkLogonRight') { $_ -replace '(,?\s*scan\b|\bscan\s*,?)', '' } else { $_ } } | Set-Content $f"
:: 4. Nap lai cau hinh bao mat vao he thong
secedit /configure /db "%temp%\temp.sdb" /cfg "%temp%\sec_config.inf" /areas USER_RIGHTS >nul
:: 5. Xoa cac file tam
del "%temp%\sec_config.inf" >nul 2>&1
del "%temp%\temp.sdb" >nul 2>&1
:: 6. Bat cac Rule Firewall can thiet cho mang LAN (File & Printer Sharing)
echo Dang mo Firewall cho mang noi bo...
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes >nul
:: 7. Cap nhat Group Policy
echo Dang cap nhat Policy he thong...
gpupdate /force >nul
echo.
echo ====================================================
echo DA CAU HINH THANH CONG CHO USER "scan"!
echo ====================================================
pause
Hướng dẫn sử dụng:
1.
Lưu file với định dạng .bat.
2.
Nhấp chuột phải vào file CauHinhLAN_Scan.bat ➔ Chọn Run as administrator.
3.
Cửa sổ dòng lệnh sẽ tự động:
-
Thêm user scan vào mục Access this computer from the network.
4.
Xóa user scan khỏi mục Deny access to this computer from the network (nếu trước đó nằm trong nhóm Deny/Guest).
5.
Mở sẵn các rule Inbound của dịch vụ chia sẻ file/máy in trên Windows Firewall.
6.
Chạy lệnh cập nhật chính sách hệ thống ngay lập tức.