Showing posts with label wsl ubuntu windows 11. Show all posts
Showing posts with label wsl ubuntu windows 11. Show all posts

Sunday, March 15, 2026

WSL notes on Win 11

 using notes from 


Ways to run multiple Linux distributions with WSL

WSL supports running as many different Linux distributions as you would like to install. This can include choosing distributions from the Microsoft Store, importing a custom distribution, or building your own custom distribution.

There are several ways to run your Linux distributions once installed:

From Windows Terminal (Recommended) Using Windows Terminal supports as many command lines as you would like to install and enables you to open them in multiple tabs or window panes and quickly switch between multiple Linux distributions or other command lines (PowerShell, Command Prompt, Azure CLI, etc). You can fully customize your terminal with unique color schemes, font styles, sizes, background images, and custom keyboard shortcuts. 
Learn more.
You can directly open your Linux distribution by visiting the Windows Start menu and typing the name of your installed distributions. For example: "Ubuntu". This will open Ubuntu in its own console window.

From PowerShell, you can enter the name of your installed distribution. For example: ubuntu

From PowerShell, you can open your default Linux distribution inside your current command line, by entering: wsl.exe.

From PowerShell, you can use your default Linux distribution inside your current command line, without entering a new one, by entering:wsl [command]. Replacing [command] with a WSL command, such as: wsl -l -v to list installed distributions or wsl pwd to see where the current directory path is mounted in wsl. From PowerShell, the command Get-Date will provide the date from the Windows file system and wsl date will provide the date from the Linux file system.

The method you select should depend on what you're doing. If you've opened a WSL command line within a PowerShell window and want to exit, enter the command: exit.

Sunday, November 9, 2025

Install , configure, anable ssh server on wsl windows 11 ubuntu

 
search terms:
https://www.google.com/search?q=install+ssh+ubuntu22.04+wsl&rlz=1C1PNKB_enUS1187US1187&oq=install+ssh+ubuntu22.04+wsl&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCDc0NTdqMGo3qAIAsAIA&sourceid=chrome&ie=UTF-8&zx=1762747609120&no_sw_cr=1

1. Update and Install OpenSSH Server in WSL:
Open your Ubuntu 22.04 WSL distribution and Update the package lists.
Code
  sudo apt update
Install the OpenSSH server.
Code
  sudo apt install openssh-server
enable and start the ssh service.
Code
  sudo systemctl enable ssh --now
2. Configure SSH in WSL (Optional but Recommended):
  • Edit the SSH configuration file to enhance security (e.g., change the default port, disable password authentication for key-based authentication):
Code
  sudo nano /etc/ssh/sshd_config
  • Modify or add lines as needed (e.g., Port 2222PasswordAuthentication noPubkeyAuthentication yes).
  • Save and exit the file.
  • Restart the SSH service for changes to take effect:
Code
  sudo service ssh restart
3. Set Up Port Forwarding on Windows:
  • Open PowerShell as Administrator on your Windows host.
  • Get the IP address of your WSL instance and set up port forwarding. Replace 2222 with your chosen SSH port if you changed it in sshd_config:
Code
  $wsl_ip = (wsl hostname -I).trim()  netsh interface portproxy add v4tov4 listenport=2222 listenaddress=0.0.0.0 connectport=2222 connectaddress=$wsl_ip
4. Configure Windows Firewall:
  • Open Windows Defender Firewall with Advanced Security.
  • Create a new Inbound Rule:
    • Select "Port" and click Next.
    • Choose "TCP" and enter the port number you are using for SSH (e.g., 2222).
    • Allow the connection and apply the rule to all profiles. 
    • Name the rule (e.g., "WSL SSH") and finish the wizard. 
5. Generate and Copy SSH Key (for key-based authentication):
  • Generate Key on Client (e.g., your Windows machine or another remote machine):
Oops, something we

--30--