Enabling SSH Server Functionality
Navigate to Windows Settings and search for "Optional Features". Locate the OpenSSH Server component in the features list. The exact interface varies slightly between Windows 10 and Windows 11, but the functionality remains consistent.
Access the Services management console and set the OpenSSH SSH Server service to Automatic startup type. Initiate the service to enable SSH connectivity.
By default, SSH authentication uses Microsoft account credentials. If password authentication is required, ensure the following configuration is disabled in system settings.
User Authentication Configuration
Windows usernames typically derive from the first five characters of the associated email address. Verify this by checking the home directory name in terminal sessions. For administrative access, the username may appear as "Administrator".
Network Configuration
Configure port forwarding to enable external access. For example, map local port 22 to a public domain on port 51001:
ssh username@example.com -p 51001
Visual Studio Code Integration
Install the "Remote - SSH" extension in VSCode. Access connection options via the status bar's double-arrow icon or the command palette (Ctrl+Shift+P). Use "Connect to Host" and specify the custom connection command:
ssh username@hostname -p port_number
After adding the host, reconnect and select "Windows" as the platform when prompted. Enter credentials and wait for the remote environment initialization. When prompted for a working directory, select the appropriate location. Note that VSCode may open a new window during this process.
The integrated terminal (Ctrl+`) supports various shells including Command Prompt, PowerShell, Git Bash, and WSL.
Terminal Connection Management
Establish direct SSH connections using standard syntax:
ssh username@example.com -p port_number
To specify PowerShell instead of the default Command Prompt environment:
ssh username@example.com -p port_number -t powershell
For PowerShell 7+ installations, ensure the executable path is in the system PATH variable. If encountering "pwsh not found" errors, manually add the installation directory to system environment variables.
Development Environment Considerations
Most VSCode derivatives require separate installation of remote development components. Maintain code synchronization through version control systems to mitigate environment discrepancies. Centralize dependencies like databases on remote servers to simplify development workflows.