Use a NAS to Remotely Control a Windows PC: A Complete Guide

    This guide explains how to combine an always-on NAS with a high-performance Windows PC using SSH-based remote execution. It covers the three-layer architecture, prerequisites, enabling and hardening the OpenSSH server on Windows, dedicated account and key-based authentication setup, reusable connection templates and task orchestration on the always-on device, web automation practices, layered troubleshooting for common failures, and a pre-launch verification checklist. The setup is intended for a private LAN or an encrypted tunnel, not for exposing remote execution ports to the public internet.

    1. Why Combine “Always On” with “High Compute”

    In local automation, always-on availability and high performance usually sit at opposite ends. Low-power storage devices are suited to running 24/7 and handling scheduling, watchdogging, and data persistence. A personal computer, with a stronger CPU, more memory, and graphics capability, is better suited to heavy workloads such as browser rendering, document processing, and compile/build jobs. Connecting the two through a standard remote execution protocol creates a complementary pipeline: the scheduler decides when work happens, and the executor does the heavy lifting.

    Typical use cases include scheduled scraping and report generation, controlled command interaction inside an intranet, chaining with other automation workflows, and batch execution of web automation. Note that this kind of setup should be deployed in a private LAN you control or behind an encrypted tunnel. Do not expose remote execution ports directly to the public internet.

    2. Architecture and Prerequisites

    The architecture has three layers:

    • Scheduling layer: an automation runtime on the always-on device, responsible for timed triggers and task orchestration.
    • Transport layer: an encrypted channel based on the standard Secure Shell (SSH) protocol, providing authentication and command delivery.
    • Execution layer: the server component on the Windows machine, a dedicated account, and the task scripts.

    The prerequisites are straightforward: the always-on device has a working automation runtime and network connectivity; the Windows machine runs a supported server version with the built-in OpenSSH server capability enabled; both sides can resolve each other’s hostname on the same LAN or reach each other by address; and the execution account has the minimum privileges required to complete the tasks.

    3. Windows Side: Enabling and Hardening the Remote Execution Service

    First, enable OpenSSH Server in the optional features of system settings, then set the service to start automatically so the link survives a reboot.

    1. # Install and start the server (requires administrator privileges)
    2. Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
    3. Set-Service -Name sshd -StartupType Automatic
    4. Start-Service sshd
    5. # Confirm the listening status
    6. Get-Service sshd

    Second, account design. Reusing a high-privilege built-in account creates two problems: the privileges are excessive, so the blast radius of leaked credentials is hard to contain; and some systems impose extra restrictions on remote password login for high-privilege accounts, which often shows up as an “account rejected” error. The safer approach is to create a dedicated remote account and grant only the privileges needed for the tasks.

    1. # Create a dedicated account and add it to the minimum required group
    2. New-LocalUser -Name "remote_agent" -Password (ConvertTo-SecureString "strong-password" -AsPlainText -Force)
    3. Add-LocalGroupMember -Group "Remote Management Users" -Member "remote_agent"

    Third, harden the authentication method. Password login should be a transitional measure; for long-term operation, switch to public key authentication and disable password and empty-password logins:

    1. # Key server-side settings (illustrative)
    2. PubkeyAuthentication yes
    3. PasswordAuthentication no
    4. PermitEmptyPasswords no
    5. MaxAuthTries 3

    On Windows, the public key usually goes into the authorized_keys file for the corresponding account. Pay attention to the access control lists on the file and its directories, or overly permissive settings will cause the key to be ignored. It is also advisable to allow only the internal network range to reach the service port through the host firewall, forming the first boundary at the network layer.

    4. Always-On Device Side: Connection Template and Task Orchestration

    The scheduler needs no complex dependencies; a basic remote connection template covers most needs. The key is to fix four steps: connect, execute, collect output, and evaluate the exit code.

    1. # Illustrative: remote execution with result collection
    2. ssh -i ~/.ssh/nas_key -o StrictHostKeyChecking=accept-new \
    3. remote_agent@192.168.1.20 \
    4. "powershell -NoProfile -Command \"Get-ComputerInfo | Select-Object CsName,OsName\""
    5. echo "exit_code=$?"

    On top of this, you can abstract a reusable execution function that takes host, account, command, and timeout as parameters, making unified logging and retry policies easier:

    1. run_remote() {
    2. local host="$1"; shift
    3. ssh -i "$KEY" -o ConnectTimeout=10 -o ServerAliveInterval=15 "$USER@$host" "$@"
    4. }

    For orchestration, follow three principles: tasks should be idempotent, so repeated runs produce no side effects; timeouts should be explicit, so a hung remote process cannot drag down the scheduler; and output should be structured, preferring key-value or marked-up text from the remote side for easier parsing. If a task requires graphics rendering, drive the browser in headless mode on the remote side and write artifacts to a shared directory or send them back to the scheduler.

    5. Putting Web Automation into Practice

    Web automation is the most common heavy workload. The script on the execution side opens pages, waits for elements, scrapes data, or submits forms; the scheduler only triggers the run and collects results. In practice, the hardest problems come not from script logic but from environment differences: mismatched default download directories, encoding, time zone, or proxy settings can make the same script behave differently on the two sides. Pin the working directory and output encoding explicitly at the top of the remote script, and send logs and screenshots to an agreed path.

    1. # Remote side: pin the working directory and encoding before running
    2. $env:PYTHONIOENCODING="utf-8"
    3. Set-Location "C:\agent_work"
    4. python task.py --out "C:\agent_work\out"

    6. Layered Troubleshooting for Frequent Failures

    • Permission denied: confirm the account status and group membership, then check the key file permissions and path, and finally verify whether the server disabled password login while the client is still using a password.
    • Connection timeout: verify layer by layer — test network reachability, check whether the host firewall allows the traffic, then confirm the service is running and the listening address is configured correctly.
    • Account rejected: often related to remote login restrictions on high-privilege accounts; switching to a dedicated low-privilege account usually resolves it.
    • Garbled output: standardize on UTF-8 and set the encoding environment variable on both client and server; if necessary, have the remote side emit plain text before parsing.
    • Session drops: enable keep-alive parameters on the client and add a limited number of exponential backoff retries on the scheduling side.

    7. Verification Checklist

    Before going live, confirm each item: the service starts automatically on boot; the dedicated account can log in and has only the necessary privileges; public key authentication works and password login is disabled; the firewall allows only intranet access; information retrieval, file transfer back, and browser automation tasks each run through once; error paths (wrong password, wrong host) return clear errors; and log and artifact locations are fixed and easy to find. Once all of these pass, this local automation pipeline from the always-on device to the high-performance machine is ready for daily reuse, and it can also integrate smoothly with general capabilities such as the container platform, message queues, and log monitoring on Baidu AI Cloud for unified orchestration across local and cloud environments.