Bash on Windows: Bash on SUSE on Windows

This article will describe installing Bash on SUSE on Windows which provides root filesystem for OpenSUSE Leap 42.2 on Windows 10.

1 Install Bash on SUSE on Windows

Install Bash on SUSE on Windows as below.

  • Enable Windows Subsystem for Linux and install Bash on Ubuntu on Windows with this way.
  • Replace root filesystem to Bash on SUSE on Windows with this way.

Now you can run root's bash on Windows.

2 Add user

Run bash.exe as root.

C:\Users\hiroom2\AppData\Local\lxss>lxrun /setdefaultuser root
C:\Users\hiroom2\AppData\Local\lxss>bash

Only adding user cannot run privilege command like zypper. You need to set root password or to use sudo. This article uses sudo.

Install sudo and enable wheel group setting.

# zypper -n in sudo
# sed -e 's/# \(%wheel.*NOPASSWD:.*\)/\1/g' -i /etc/sudoers

If you need visudo, install editor.

# zypper -n in nano
# EDITOR=nano visudo # vi does not need EDITOR.

Add new user and add user to wheel group.

# useradd hiroom2
# passwd hiroom2
New password:
Retype new password:
# gpasswd -a hiroom2 wheel

Terminate bash.exe.

# exit

Run bash.exe as added user.

C:\Users\hiroom2\AppData\Local\lxss>lxrun /setdefaultuser hiroom2
C:\Users\hiroom2\AppData\Local\lxss>bash
$ # This is added user bash.

3 Run ssh server

You cannot user systemctl because D-BUS does not work. You need to run sshd command directly.

$ sudo zypper -n in openssh
$ sudo /usr/sbin/sshd-gen-keys-start
$ sudo /usr/sbin/sshd -D &