Stopping and starting the Windows 10 version of TNFS server via SSH

I recently set up a TNFS server to use with FujiNet on my Atari 8-bits. Most people run the server on a Raspberry Pi, but with the current energy crisis(!) I wanted to do it from my always-on Windows 10 machine. After using files on FujiNet, even if I eject them from slots, I frequently can’t modify or delete them as they’re reported as in-use by the client I’m using, even when the FujiNet device is turned off. I haven’t tried this yet to see if it fixes the problem, but in any case, I wanted to find an easy way of restarting the server without needing to physically be on the Windows machine.

I chose to do this via SSH using Powershell. Here are the instructions for doing so in case it helps you out. Obviously this can be used to stop/start any service you like, and from any OS that gives you the ability to SSH into another machine.

Install SSH server on Windows 10 via Powershell:

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~

Start and configure server:

Start the sshd service

Start-Service sshd

OPTIONAL but recommended:

Set-Service -Name sshd -StartupType 'Automatic'

Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify:

if (!(Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {
Write-Output "Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it…"
New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
} else {
Write-Output "Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."

Set Powershell to be default shell over OpenSSH:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

To stop the TNFS server:

taskkill /F /IM tnfsd.exe

To start the TNFS server:

start-process C:\tnfsd\tnfsd.exe C:\tnfsroot

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s