A recent SAS Communities post got me thinking about running SAS Management Console using WSL2. In that post, the questioner was asking about how to manage multiple SAS environments with different SAS 9.4 maintenance levels (M5 and M8) from a single client device. I posted that one of the ways to do it was to run SAS Management Console remotely, as each SAS environment will have the corresponding SAS Management Console version installed. One of the ways to do this, when the SAS server is on Linux, is to use X-Windows software for Windows (like MobaXterm). Behind the scenes an SSH session is used to connect to the server and run SAS Management Console using X11 forwarding so that the app appears locally on the Windows workstation. I regularly encounter SAS customers using MobaXterm to do this and I occasionally use it myself when on Windows (my primary desktop is Linux so I normally just use SSH with X11 Forwarding without any additional software). It also occurred to me that, with recent enhancements to the Windows Subsystem for Linux (WSL), you can now do this with native Windows features and don’t need any additional software. I set out to try it for myself.
You can find out more about this method in the Microsoft article Run Linux GUI apps on the Windows Subsystem for Linux. I used Windows 10 but it also works with Windows 11.
First I installed WSL as described in the article: run “wsl –install” in an administrator PowerShell and reboot when done.
I prefer Debian over Ubuntu, so I removed Ubuntu, made WSL2 the default, and installed Debian instead:
wsl --unregister Ubuntu
wsl --set-default-version 2
wsl --install -d Debian
Once Debian was available, I updated it and installed the ssh client:
sudo apt update
sudo apt full-upgrade
sudo apt install openssh-client
With everything ready, I was able to ssh with X11 forwarding (-X) to a remote SAS server on Linux, authenticate, and run the SAS Management Console command:
ssh -X sasdemo@sas94m8lnx01 /opt/sas94m8/sashome/SASManagementConsole/9.4/sasmc
If I wanted to simultaneously work on another server with a difference maintenance level I would just run the SAS Management Console command on that server instead:
ssh -X sasdemo@sas94m7lnx01 /opt/sas94m7/sashome/SASManagementConsole/9.4/sasmc
If you want to encapsulate this in a start menu icon, you can also create a Windows shortcut that has a command like so:
C:\Windows\System32\wsl.exe --distribution Debian bash -c "ssh -X sasdemo@sas94m8lnx01 /opt/sas94m8/sashome/SASManagementConsole/9.4/sasmc"
I hope you found this useful. I think this is going to be my preferred method for running remote SAS Management Console on Linux from a Windows workstation now.