I installed Ubuntu 22.04.3 LTS in WSL2 according to instructions here.
Then I installed SSH server according to instructions here.
Then I installed ubuntu-wsl2-systemd-script to enable systemd support in WSL2. During reboot of Ubuntu in WSL2, line 45-47 of
I cannot find out what processes are using port 2022 because the results returned from
So, how can I keep (most of) ubuntu-wsl2-systemd-script while have SSH service working?
Then I installed SSH server according to instructions here.
Then I installed ubuntu-wsl2-systemd-script to enable systemd support in WSL2. During reboot of Ubuntu in WSL2, line 45-47 of
enter-systemd-namespace
script enters systemd namespace:But this makes the SSH service stop working. If I run systemctl status ssh.service, I got the following error messages:exec /usr/bin/nsenter -t "$SYSTEMD_PID" -a \
/bin/login -p -f "$SUDO_USER" \
$([ -f "$USER_HOME/.systemd-env" ] && /bin/cat "$USER_HOME/.systemd-env" | xargs printf ' %q')
Jan 04 09:01:48 DESKTOP-J2VCDBO systemd[1]: Starting OpenBSD Secure Shell server...
Jan 04 09:01:48 DESKTOP-J2VCDBO sshd[246]: error: Bind to port 2022 on 0.0.0.0 failed: Address already in use.
Jan 04 09:01:48 DESKTOP-J2VCDBO sshd[246]: error: Bind to port 2022 on :: failed: Address already in use.
Jan 04 09:01:48 DESKTOP-J2VCDBO sshd[246]: fatal: Cannot bind any address.
Jan 04 09:01:48 DESKTOP-J2VCDBO systemd[1]: ssh.service: Main process exited, code=exited, status=255/EXCEPTION
Jan 04 09:01:48 DESKTOP-J2VCDBO systemd[1]: ssh.service: Failed with result 'exit-code'.
Jan 04 09:01:48 DESKTOP-J2VCDBO systemd[1]: Failed to start OpenBSD Secure Shell server.
I cannot find out what processes are using port 2022 because the results returned from
sudo netstat -tulnp | grep 2022
contain no process information:tcp 0 0 0.0.0.0:2022 0.0.0.0:* LISTEN -
tcp6 0 0 :::2022 :::* LISTEN -
So, how can I keep (most of) ubuntu-wsl2-systemd-script while have SSH service working?