I recently reinstalled Windows 10 and my hostname is DESKTOP-XXXXXX. I'm trying to change it to something else. I tried the following:
sudo hostname wsl
I also changed /etc/hostname
to "wsl" and changed /etc/hosts
to "127.0.1.1 wsl.localdomain wsl".
Every time I restart WSL, it resets the hostname. How do I change the hostname permanently?
Administrator privileges in Windows are required to run OpenSSH in WSL. To run an OpenSSH server, run your WSL distribution (ie Ubuntu) or Windows Terminal as an administrator.
In Windows 10 Home 64-bit, Fall Creators Update edition (Version 1709, Build 16299.19) I used:
Settings
▸ System
▸ About
▸ Rename this PC
After that a restart is required.
Try to change the host system's name from System --> Change Settings --> Change
. It makes sense for WSL to update its hostname to match that of the host computer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With