Wiki‎ > ‎

Remote license server via ssh tunnel

posted Aug 6, 2019, 8:48 PM by Danny Xu
1: what’s the hostname of your campus Mathematica license server? Something like, I’m going to call it MY_LICENSE_SERVER below.

2: what’s the port number for the campus Mathematica license server? Something like 27000, I’m going to call it LS_PORT below.

3: what’s the internal port number for the Mathematica license server? Might be something like 37000, I’m going to call it INTERNAL_PORT below.

4: what’s the hostname of a system at your campus you can ssh into from off campus (specifically Bridges)? This system does not have to have Mathematica installed, but does need to be able to see the Mathematica license server. This has to be exposed to the Internet, no VPNs allowed for this method (others might know other alternatives). I’m going to call it SSH_HOST below.

You should be able to find items 1-2 from whatever Mathematica license file or environment variable you normally use. Item 3 is not as easily found, but whoever runs your campus Mathematica license server can find it in their FlexLM files on that server. Item 4 is up to you and others at your campus.

Once you’ve know all four items above, you should be able to log into Bridges, and then run:


Once that’s done and in the background, you’ll have an ssh tunnel connecting LS_PORT and INTERNAL_PORT on the local Bridges node to LS_PORT and INTERNAL_PORT on your campus license server.

You should be able to set a license file environment variable for Mathematica to point to the Bridges end of the tunnel. Not sure what environment variable is specific to Mathematica, but many programs will fall back to using LM_LICENSE_FILE. In that case, if you’re using bash on Bridges, you can run:


before running Mathematica.