How to Remotely Control a Windows PC from Your NAS Using SSH: A Step-by-Step Guide
Learn how to set up a reliable SSH-based automation link between your NAS and a Windows PC. This guide covers enabling the built-in OpenSSH Server on Windows, creating a dedicated remote account to bypass admin login restrictions, building reusable connection templates on the NAS, troubleshooting common failures like permission denied and connection timeouts, and verifying the whole pipeline for stable, scheduled automation.
NAS devices are designed to run 24/7 with low power consumption and high stability, making them ideal for scheduled task orchestration and automation triggers. Windows PCs, on the other hand, offer far more computing power, which suits heavy workloads such as browser automation, batch file processing, and compilation builds. By connecting the two, you can build a complete local automation pipeline: the NAS handles scheduling, while the Windows PC handles execution.
This setup is particularly useful for the following scenarios:
- Scheduled control of a Windows PC: For example, waking the machine at night to run a script, then shutting it down automatically when finished;
- Secure command exchange over the LAN: Sending commands through an encrypted SSH channel instead of plaintext, avoiding security risks;
- Cross-device automation: NAS task flows trigger actions on the Windows side under specific conditions, enabling orchestration across devices;
- Browser automation: Remotely driving a browser on Windows to perform logins, data collection, form submissions, and more.
The technical core of this pipeline is the SSH protocol: the Windows side enables the built-in SSH server component, and the NAS acts as the SSH client, initiating connections to execute commands or transfer files. All traffic is encrypted, and no extra ports need to be exposed to the public internet.
Part 1: Windows Side — Enable SSH Service and Fix Permission Restrictions
1.1 Enable the Built-in OpenSSH Server
Recent versions of Windows include an optional SSH server feature. You can add the “OpenSSH Server” component via “Settings → Apps → Optional Features” (the entry name may vary slightly between versions). After installation, make sure the corresponding service is running and set to start automatically.
Use the following PowerShell commands to check and start the service:
# Check SSH service statusGet-Service -Name *ssh*# Start the service and set it to auto-start on bootSet-Service -Name sshd -StartupType AutomaticStart-Service -Name sshd
Also make sure the firewall allows SSH traffic on the default port 22 (or your custom port):
New-NetFirewallRule -DisplayName "Allow SSH" -Direction Inbound `-Protocol TCP -LocalPort 22 -Action Allow
1.2 SSH Login Restrictions for Administrator Accounts
A common pitfall: in some system configurations, the built-in Administrator account is rejected when logging in via SSH, even with the correct password. This is usually caused by remote login policy restrictions applied to administrator accounts.
There are two ways to handle this:
- Adjust local security policies: Check whether policies such as “Deny access to this computer from the network” include the administrator account, and remove it if needed;
- The recommended approach — create a dedicated remote account: Instead of using the built-in Administrator account, create a separate account with controlled permissions. This bypasses the built-in admin restrictions and follows the principle of least privilege, making auditing and revocation much cleaner.
1.3 Create a Dedicated Remote Account
Example commands for creating a dedicated account:
# Create the account and set a passwordnet user ssh-runner /addnet user ssh-runner "your-strong-password"# Add it to a remote management group if needednet localgroup Administrators ssh-runner /add
Best practices:
- Use a strong, randomly generated password and never reuse your daily account password;
- If the account only needs to run specific tasks, add it to a standard user group and grant access via scheduled tasks or allowlists instead of giving it administrator rights;
- Rotate the password regularly, or switch to SSH key authentication once key-based login is confirmed stable.
Part 2: NAS Side — Build a Reusable Remote Connection Template
The main work on the NAS side is preparing a reusable connection template, which typically includes these elements:
- Host address: The LAN IP of the Windows PC. It’s best to bind a static IP or a DHCP reservation on the router or the host itself to avoid connection failures caused by IP changes;
- Port: Default is 22; keep it consistent if you changed the service and firewall port;
- Authentication: Password or key. For production use, key authentication is recommended, with the private key stored securely on the NAS;
- Execution mode: Run a single command after connecting, run a script, or open an interactive session.
The general structure of the connection commands is as follows (adjust client syntax to your environment):
# Run a single remote commandssh ssh-runner@192.168.1.100 "systeminfo | findstr /B /C:\"OS Name\""# Upload a file to Windowsscp ./report.zip ssh-runner@192.168.1.100:C:/Users/ssh-runner/Desktop/# Download a file from Windowsscp ssh-runner@192.168.1.100:C:/logs/app.log ./
The benefit of templating is that connection parameters are decoupled from business commands: whether you’re querying system info, transferring files, or triggering browser automation, you only need to swap out the execution command.
2.1 Common Remote Operations
- Query system info: Retrieve hostname, OS version, CPU/memory usage, and free disk space as pre-task checks;
- File transfer: Upload data packages to process and download results and logs;
- Drive browser automation: Pre-deploy automation scripts on the Windows side, then invoke them via SSH from the NAS to launch the browser. Note that browser automation must run inside a logged-in desktop session — a locked screen may interfere with UI rendering. Set power policies to prevent sleep, and make sure your automation framework supports headless mode or keeps the session unlocked.
Part 3: Troubleshooting Common Failures
The following four issues occur most frequently. Work through the corresponding checks step by step.
3.1 Permission Denied
- Verify the username and password are correct. Note that Windows accounts may need to log in as “COMPUTERNAME\username” or just “username”;
- Check whether the account is blocked from remote access by local policy;
- If using key authentication, confirm the public key is in the correct location with proper file permissions;
- Confirm the sshd service is running.
3.2 Connection Timed Out
- Check whether the Windows firewall allows the SSH port; temporarily disabling the firewall can help isolate the issue;
- Confirm the host IP is correct and that the NAS and host are on the same LAN or a routable network segment;
- Use
pingandTest-NetConnectionto verify connectivity:
Test-NetConnection 192.168.1.100 -Port 22
- If the host is asleep or powered off, wake it first via Wake-on-LAN or similar methods.
3.3 Account Rejected (Login Refused)
- Confirm the dedicated account is enabled and not expired;
- Check whether the account is locked out (repeated wrong passwords can trigger lockout policies);
- If the built-in Administrator account is restricted by policy, simply switch to the dedicated account.
3.4 Garbled Output
Windows and Linux use different default character encodings (e.g., GBK vs. UTF-8), so Chinese text often becomes garbled when running commands across systems. Fixes:
- On Windows, enable “Beta: Use Unicode UTF-8 for worldwide language support” in the regional settings, or standardize script output as UTF-8;
- On the NAS side, convert according to the actual encoding when parsing;
- Avoid relying on localized text in command output — prefer machine-readable formats (CSV, JSON) wherever possible.
Part 4: Hands-On Verification Checklist
After deployment, run through the following checks. If all pass, the pipeline is complete and ready to use:
- Service alive:
Get-Service sshdon Windows shows “Running”; - Network reachable: The NAS can
pingthe host IP, and port 22 is reachable; - Basic login: SSH login from the NAS succeeds and you see a Windows command prompt;
- Info query: Remote system info commands execute correctly with no garbled output;
- File upload: Transfer a test file from the NAS to Windows and confirm it exists on the Windows side;
- File download: Retrieve a log file from Windows and verify its contents are intact;
- Automation trigger: Remotely invoke a browser automation script and confirm the task runs and produces results;
- Stability check: Run scheduled tasks continuously for several days and watch for authentication failures, timeouts, or lingering sessions;
- Security review: Confirm the SSH port is only accessible from the LAN, account password strength is adequate, and switch to key authentication if necessary.
Part 5: Security and Maintenance Recommendations
- LAN-only exposure: Never port-forward SSH to the public internet; if remote access is needed, connect via VPN back into the LAN first;
- Keys first: When possible, disable password login and allow only key authentication;
- Least privilege: Grant the dedicated account only the permissions its tasks require; avoid长期 admin usage — run as administrator only when necessary;
- Audit logging: Regularly review SSH login logs on the Windows side and watch for abnormal login attempts;
- Change management: After changing ports, accounts, or firewall rules, re-run the verification checklist to prevent configuration drift from silently breaking scheduled tasks.
Conclusion
The essence of this setup is using SSH as a cross-device control plane, combining the always-on availability of a NAS with the computing power of a Windows PC. There are three key steps: enable the built-in SSH service on Windows and create a dedicated remote account to bypass administrator restrictions; build a reusable connection template on the NAS covering info queries, file transfers, and automation triggers; and finally, rely on a systematic troubleshooting checklist and hands-on verification process to keep the pipeline stable over time. Once deployed, scheduled tasks, LAN command exchange, and browser automation can all run reliably on this link — a true local automation loop.
