<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WSL &#8211; Sandy Scott&#039;s Web Spot</title>
	<atom:link href="https://www.sandyscott.net/tag/wsl/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sandyscott.net</link>
	<description>My little corner of the web</description>
	<lastBuildDate>Fri, 02 Apr 2021 15:47:12 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>Install Sage Math from source on WSL</title>
		<link>https://www.sandyscott.net/2020/12/install-sage-math-from-source-on-wsl/</link>
					<comments>https://www.sandyscott.net/2020/12/install-sage-math-from-source-on-wsl/#comments</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Wed, 02 Dec 2020 15:59:14 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sage]]></category>
		<category><![CDATA[sagemath]]></category>
		<category><![CDATA[WSL]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=747</guid>

					<description><![CDATA[Here&#8217;s how I got a fully featured Sage Math install on my system. I did this because I wanted to run on windows, and still be able to install packages, which isn&#8217;t possible with the precompiled binary. Basic process: Enable hardware assisted virtualization. Set up WSL (Windows Subsystem for Linux)...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/12/install-sage-math-from-source-on-wsl/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>Here&#8217;s how I got a fully featured Sage Math install on my system. I did this because I wanted to run on windows, and still be able to install packages, which isn&#8217;t possible with the precompiled binary.</p>



<h2 class="wp-block-heading">Basic process:</h2>



<ol class="wp-block-list"><li>Enable hardware assisted virtualization.</li><li>Set up WSL (Windows Subsystem for Linux)</li><li>Install Linux into WSL</li><li>Download and compile Sage</li><li>Configure JupyterLab</li><li>Make it easy to start from windows</li></ol>



<h2 class="wp-block-heading">Enable hardware assisted virtualization</h2>



<p>WSL requires that your system supports hardware assisted virtualization (which pretty much all modern systems do), there are 3 things that you need to get it working:</p>



<ul class="wp-block-list"><li>The CPU must support it</li><li>The motherboard must support it.</li><li>You need to enable it in the EFI (or BIOS)</li></ul>



<p>This article takes you through getting everything sorted out:</p>



<p><a href="https://support.bluestacks.com/hc/en-us/articles/115003174386-How-to-enable-Virtualization-VT-on-Windows-10-for-BlueStacks-4">https://support.bluestacks.com/hc/en-us/articles/115003174386-How-to-enable-Virtualization-VT-on-Windows-10-for-BlueStacks-4</a></p>



<h2 class="wp-block-heading">Set up WSL 2</h2>



<p>Follow this guide: <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">https://docs.microsoft.com/en-us/windows/wsl/install-win10</a></p>



<h2 class="wp-block-heading">Install and configure Linux:</h2>



<ol class="wp-block-list"><li>Go to the Microsoft store and install Ubuntu.</li></ol>



<p>Note: If you already have Ubuntu installed, I&#8217;d recommend you follow these instructions to set up a separate, clean install for sage: <a href="https://hfakhraei.github.io/Install-multiple-instance-of-same-Linux-Distribution-on-WSL">https://hfakhraei.github.io/Install-multiple-instance-of-same-Linux-Distribution-on-WSL</a></p>



<ol class="wp-block-list" start="2"><li>Start Ubuntu from the start menu. A command window should pop up.</li><li>Run these commands to update Ubuntu:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">    sudo apt update
    sudo apt upgrade</pre></div>



<ol class="wp-block-list" start="4"><li>Reboot by going (in Windows) to Services and restarting the LxssManager. You can also shut down all running WSL instances using the command <code>wsl --shutdown</code> in the Windows command prompt or Powershell.</li><li>If necessary upgrade to the latest release: <a href="https://linuxconfig.org/how-to-upgrade-ubuntu-to-20-10">https://linuxconfig.org/how-to-upgrade-ubuntu-to-20-10</a></li></ol>



<h2 class="wp-block-heading">Set up Sage</h2>



<p>These instructions are a simplified version of the official documentation: <a href="https://doc.sagemath.org/html/en/installation/source.html">https://doc.sagemath.org/html/en/installation/source.html</a></p>



<ol class="wp-block-list"><li>Start Ubuntu &#8211; All the commands in this section should be run on the Ubuntu installation.</li><li>Install the packages we need to have ready in advance:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install bc binutils bzip2 ca-certificates cliquer cmake coinor-cbc coinor-libcbc-dev curl default-jdk dvipng eclib-tools fflas-ffpack ffmpeg flintqs g++ gcc gfan gfortran git glpk-utils gmp-ecm imagemagick latexmk lcalc libatomic-ops-dev libavdevice-dev libboost-dev libbraiding-dev libbrial-dev libbrial-groebner-dev libbz2-dev libcdd-dev libcdd-tools libcliquer-dev libcurl4-openssl-dev libec-dev libecm-dev libffi-dev libfile-slurp-perl libflint-arb-dev libflint-dev libfreetype6-dev libgc-dev libgd-dev libgf2x-dev libgiac-dev libgivaro-dev libglpk-dev libgmp-dev libgsl-dev libiml-dev libisl-dev libjson-perl liblfunction-dev liblrcalc-dev liblzma-dev libm4rie-dev libmongodb-perl libmpc-dev libmpfi-dev libmpfr-dev libnauty-dev libncurses5-dev libntl-dev libopenblas-dev libpari-dev libpcre3-dev libperl-dev libplanarity-dev libppl-dev libpython3-dev libreadline-dev librw-dev libsqlite3-dev libssl-dev libsuitesparse-dev libsvg-perl libsymmetrica2-dev libterm-readkey-perl libterm-readline-gnu-perl libxml2-dev libxml-libxslt-perl libxml-writer-perl libz-dev libzmq3-dev libzn-poly-dev m4 make nauty ninja-build openssl palp pandoc pari-doc pari-elldata pari-galdata pari-galpol pari-gp2c pari-seadata patch perl pkg-config planarity ppl-dev python3 python3-distutils r-base-dev r-cran-lattice sqlite3 sympow tachyon tar texlive texlive-xetex xcas xz-utils yasm</pre></div>



<ol class="wp-block-list" start="3"><li>Download and extract the source tarball into a subfolder of your home directory</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd ~
wget http://www.mirrorservice.org/sites/www.sagemath.org/src/sage-9.2.tar.gz
tar xvf sage-9.2.tar.gz</pre></div>



<ol class="wp-block-list" start="4"><li>Start building</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd sage-9.2/
./configure
make</pre></div>



<p>This will take a long time (3 hours on my system)</p>



<ol class="wp-block-list" start="5"><li>Test sage</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">./sage</pre></div>



<p>You should get a prompt that looks like this:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24                     │
│ Using Python 3.8.6. Type &quot;help()&quot; for help.                        │
└────────────────────────────────────────────────────────────────────┘
sage:</pre></div>



<ol class="wp-block-list" start="6"><li>Type <code>exit </code>and press enter to leave.</li></ol>



<ol class="wp-block-list" start="7"><li>Make the command available from anywhere on this ubuntu system &#8211; edit ~/.bashrc and add this line:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">alias sage=~/sage-9.2/sage</pre></div>



<ol class="wp-block-list" start="8"><li>Close ubuntu then reopen it.</li><li>Try typing <code>sage</code> and verify that it starts.</li></ol>



<h2 class="wp-block-heading">JupyterLab</h2>



<ol class="wp-block-list"><li>Install Jupyter Lab and it&#8217;s extras:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sage -i jupyterlab_widgets</pre></div>



<p>This also involves compliation from source, so will take a while.</p>



<ol class="wp-block-list" start="2"><li>When it&#8217;s done, try starting the jupyterlab notebook like this:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sage --notebook jupyterlab</pre></div>



<p>You might notice a problem &#8211; the list of files only includes those on your linux machine &#8211; you probably want the ones on your windows computer. You can do this by navigating to where the windows files are mounted in linux.</p>



<ol class="wp-block-list" start="3"><li>Try it (fill in your windows username instead of the square brackets):</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd /mnt/c/Documents\ and\ Settings\[your windows username]
sage --notebook jupyterlab</pre></div>



<p>The list of files should now be the ones in that folder on your windows machine.</p>



<ol class="wp-block-list" start="4"><li>Lets wrap this all in a script for convenience &#8211; Create a file called ~/<code>sage_nb.sh</code> and put these lines into it:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">#!/bin/bash
cd /mnt/c/Documents\ and\ Settings/[your windows username]
/home/[your linux username]/sage-9.2/sage --notebook jupyterlab</pre></div>



<ol class="wp-block-list" start="5"><li>We need to make it executable &#8211; ie. so linux will run this file like it would run a program:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">chmod ug+x sage_nb.sh</pre></div>



<ol class="wp-block-list" start="6"><li>Now go back to your home directory and try it again:</li></ol>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">cd ~
./sage_nb.sh</pre></div>



<p>The JupyterLab server should start, showing your windows files in the browser.</p>



<h2 class="wp-block-heading">Create windows shortcut</h2>



<p>This is a final nicety that lets you start the JupyterLab server in one click:</p>



<ol class="wp-block-list"><li>Open Windows explorer, and type %APPDATA%\Microsoft\Windows\Start Menu\Programs</li><li>Make a copy of any of the program icons &#8211; we&#8217;ll customise it to do what we want</li><li>Right-click, and choose properties.</li><li>On the General tab:<ul><li>Change the name to whatever you want.</li></ul></li><li>On the Shortcut tab:<ul><li>Change Target to: <code>ubuntu.exe run ~/sage_nb.sh</code></li><li>Change Start in to: <code>%USERPROFILE%</code></li><li>Change Run to: Minimised</li><li>Change the icon if you want &#8211; there are plenty of pieces of software that can create a <code>.ico</code> icon file one from an image file.</li></ul></li><li>Now hit the start button or key and type the name you gave it. it should appear in the list, and should load the server and fire up your browser when you click on it.</li></ol>



<dl class="wp-block-simple-definition-list-blocks-list"></dl>



<h2 class="wp-block-heading">Software versions:</h2>



<p>This is what I used when I wrote this post &#8211; you might get different results if your versions are significantly different.</p>



<ul class="wp-block-list"><li>Windows 10 Pro Version 2004 (OS Build 19041.264)</li><li>Ubuntu 20.10 (Originally installed 20.04 as 20.10 was not available in the Windows Store)</li><li>Sage 9.2</li></ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/12/install-sage-math-from-source-on-wsl/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>Copy/Paste from Linux to Windows via SSH</title>
		<link>https://www.sandyscott.net/2020/05/copy-paste-from-linux-to-windows-via-ssh/</link>
					<comments>https://www.sandyscott.net/2020/05/copy-paste-from-linux-to-windows-via-ssh/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Sun, 10 May 2020 21:43:26 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[VcXsrv]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[WSL]]></category>
		<category><![CDATA[WSLtty]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=296</guid>

					<description><![CDATA[Ever wanted to copy and paste from a Linux machine you&#8217;re SSH&#8217;d into? Then read on! If you haven&#8217;t done already, take a look at my previous post to use wsltty to view the local WSL installation, which is then used to ssh into a remote box. For the purpose...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/copy-paste-from-linux-to-windows-via-ssh/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>Ever wanted to copy and paste from a Linux machine you&#8217;re SSH&#8217;d into? Then read on!</p>



<p>If you haven&#8217;t done already, take a look at <a href="https://www.sandyscott.net/2020/05/03/best-ssh-setup-for-windows/">my previous post to use wsltty to view the local WSL installation, which is then used to ssh into a remote box.</a></p>



<p>For the purpose of this explanation the <strong>client </strong>is the machine you&#8217;re sitting at, and the <strong>server </strong>is the remote machine you&#8217;re connecting to.</p>



<p>First, we need to get SSH X11 Forwarding working. This would normally be used for running graphical applications, but we&#8217;re just using it for the clipboard feature.</p>



<h2 class="wp-block-heading">Server Configuration</h2>



<p>You should have these lines uncommented in <code>/etc/ssh/sshd_config</code></p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;properties&quot;,&quot;mime&quot;:&quot;text/x-properties&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Properties files&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;properties&quot;}">X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no</pre></div>



<p>When you&#8217;re done restart the ssh daemon, on my (Debian) system the command is this:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo systemctl restart ssh</pre></div>



<p>If you&#8217;re running a firewall on the server you need to enable loopback. I&#8217;m using iptables, so this is how I&#8217;d do it:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo iptables -I INPUT -i lo -j ACCEPT
sudo iptables -I OUTPUT -o lo -j ACCEPT
su -
iptables-save &gt; /etc/iptables/rules.v4
exit</pre></div>



<h2 class="wp-block-heading">Client configuration</h2>



<p>From within WSL (but not ssh&#8217;d into a remote system), Install xauth and xterm:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install xauth xterm</pre></div>



<p>A big thanks to this video for help with the next section: <a href="https://www.youtube.com/watch?v=_MgrjgQqDcE">youtube.com/watch?v=_MgrjgQqDcE</a></p>



<p>In Windows, download and install VcXsrv <a href="https://sourceforge.net/projects/vcxsrv/">https://sourceforge.net/projects/vcxsrv/</a></p>



<p>Find XLaunch in the start menu and run it. </p>



<p>On the first screen choose <strong>Multiple Windows</strong> and set the <strong>Display number</strong> to 0:</p>



<figure class="wp-block-image size-large is-resized"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image.png"><img decoding="async" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image.png" alt="" class="wp-image-302" width="250" height="196" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image.png 499w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-300x236.png 300w" sizes="(max-width: 250px) 100vw, 250px" /></a></figure>



<p>Choose <strong>Start no client</strong> on the next page:</p>



<figure class="wp-block-image is-resized"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-1.png"><img decoding="async" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-1.png" alt="" class="wp-image-303" width="250" height="196" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-1.png 499w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-1-300x236.png 300w" sizes="(max-width: 250px) 100vw, 250px" /></a></figure>



<p>Make sure <strong>Clipboard</strong> is turned on</p>



<figure class="wp-block-image size-large is-resized"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-2.png"><img decoding="async" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-2.png" alt="" class="wp-image-304" width="250" height="196" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-2.png 499w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-2-300x236.png 300w" sizes="(max-width: 250px) 100vw, 250px" /></a></figure>



<p>Press <strong>Save configuration</strong>. </p>



<figure class="wp-block-image size-large is-resized"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-3.png"><img loading="lazy" decoding="async" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-3.png" alt="" class="wp-image-305" width="250" height="196" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-3.png 499w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-3-300x236.png 300w" sizes="(max-width: 250px) 100vw, 250px" /></a></figure>



<p>Type <strong>shell:startup</strong> in the address bar and hit enter &#8211; this will take you to a special folder &#8211; files saved here will run when a user logs in. The filename should be pre-populated as <strong>config.xlaunch</strong>. That&#8217;s OK so hit <strong>Save</strong>, and then <strong>Finish</strong> in the previous window.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://www.sandyscott.net/wp-content/uploads/2020/05/image-5.png"><img loading="lazy" decoding="async" src="https://www.sandyscott.net/wp-content/uploads/2020/05/image-5.png" alt="" class="wp-image-331" width="347" height="211" srcset="https://www.sandyscott.net/wp-content/uploads/2020/05/image-5.png 694w, https://www.sandyscott.net/wp-content/uploads/2020/05/image-5-300x182.png 300w" sizes="(max-width: 347px) 100vw, 347px" /></a></figure>



<p>Finally, go back to WSL. This command tells your local WSL (the client) where to find the display. SSH uses that information when you link to the remote computer (server).</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">export DISPLAY=localhost:0</pre></div>



<p>You can also save this line into <code>~/.bashrc</code> on the client to load it every time WSL starts.</p>



<h2 class="wp-block-heading">Connect and Test</h2>



<p>In WSL, connect to the server with a slightly modified command:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">ssh -Y joebloggs@remotelinuxcomputer.example.com</pre></div>



<p>The <strong>-Y</strong> tells ssh you want to link the server to the VcXsrv software, so the server can display things on the client&#8217;s screen.</p>



<p>Let&#8217;s test with xeyes</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">sudo apt install xeyes
xeyes</pre></div>



<p>A pair of eyes should appear on your screen, and follow the mouse around.</p>



<h2 class="wp-block-heading">Put it to use!</h2>



<p>So, what we have now is that anything that goes onto the Linux system clipboard (xclip) should end up on the Windows clipboard too. Lets give it a try. Pipe some data to xclip:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">echo &quot;I'm copied, paste me!&quot; | xclip -i</pre></div>



<p>Now try pasting that into a text editor on windows.</p>



<p>Next, copy some text in windows, then go back to your ssh session and type:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">xclip -o</pre></div>



<p>The text you copied should appear on a new line in the terminal.</p>



<p>The real power of this comes when combined with terminal applications that are aware of the system clipboard. For me, I wanted to copy from <code>vim</code> in an ssh session, and then paste into windows. If you&#8217;re using a version of vim with enough features (I use <code>vim-gtk</code>), all you have to do is add this to your <code>~/.vimrc</code>:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}">&quot; Yank goes to system clipboard, to aid with WSL copy/paste
set clipboard=unnamedplus</pre></div>



<p>Now, anything copied by the yank commands ends up in the windows clipboard too.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/copy-paste-from-linux-to-windows-via-ssh/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Best ssh setup for windows</title>
		<link>https://www.sandyscott.net/2020/05/best-ssh-setup-for-windows/</link>
					<comments>https://www.sandyscott.net/2020/05/best-ssh-setup-for-windows/#respond</comments>
		
		<dc:creator><![CDATA[Sandy]]></dc:creator>
		<pubDate>Sun, 03 May 2020 15:51:57 +0000</pubDate>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mintty]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Windows Subsystem for Linux]]></category>
		<category><![CDATA[WSL]]></category>
		<category><![CDATA[WSLtty]]></category>
		<guid isPermaLink="false">https://www.sandyscott.net/?p=280</guid>

					<description><![CDATA[I&#8217;ve tried quite a few different setups for administering my various linux boxen from Windows, and this is currently my favourite: Mintty for WSL (aka WSLtty). Here&#8217;s how to set it up. Install Windows Subsystem for Linux (WSL): Open Powershell as an administrator Enter this command:Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux When...<p> <a class="continue-reading-link" href="https://www.sandyscott.net/2020/05/best-ssh-setup-for-windows/"><span>Continue reading</span><i class="crycon-right-dir"></i></a> </p>]]></description>
										<content:encoded><![CDATA[
<p>I&#8217;ve tried quite a few different setups for administering my various linux boxen from Windows, and this is currently my favourite: Mintty for WSL (aka WSLtty).</p>



<p>Here&#8217;s how to set it up.</p>



<h2 class="wp-block-heading">Install Windows Subsystem for Linux (WSL):</h2>



<ol class="wp-block-list"><li>Open Powershell as an administrator</li><li>Enter this command:<br><code>Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux</code></li><li>When it&#8217;s done, restart your computer.</li></ol>



<h2 class="wp-block-heading">Install Linux (on WSL)</h2>



<p>I recommend Debian &#8211; it&#8217;s well supported by the community, and a pretty lightweight install compared to some of the other choices.</p>



<p>For the local windows store</p>



<ol class="wp-block-list"><li>Open the Windows Store</li><li>Search for &#8220;Debian&#8221;</li><li>Click on Get</li><li>Click on Install</li></ol>



<p>Once it&#8217;s installed:</p>



<ol class="wp-block-list"><li>Find and click on the Debian app in your start menu</li><li>Wait for a moment, then set up a username for this local installation of linux. It&#8217;ll be slightly more convenient if you use the same username you have on your remote linux machines.</li><li>Exit the terminal: type:<br><code>exit</code><br>and press enter.</li></ol>



<p>This info came from <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">https://docs.microsoft.com/en-us/windows/wsl/install-win10</a></p>



<h2 class="wp-block-heading">Install WSLtty</h2>



<ol class="wp-block-list"><li>Go to <a href="https://github.com/mintty/wsltty/releases/latest">https://github.com/mintty/wsltty/releases/latest</a></li><li>Choose the right release for your system &#8211; unless you have a fairly old computer it&#8217;ll be the one ending in &#8220;x86_64.exe&#8221;</li><li>Download and install.</li><li>This app isn&#8217;t digitally signed in a way approved by Microsoft, so a warning will pop up (&#8220;Windows protected your PC&#8221;). Click <strong>More info</strong> then <strong>Run anyway</strong>.</li></ol>



<h2 class="wp-block-heading">Run and connect!</h2>



<p>Mintty should have installed a shortcut called &#8220;WSL Terminal&#8221; with the linux penguin icon, click on it and you&#8217;ll get a black terminal windows with prompt in the top left: <code>[your unix username]@[computer name]:~$</code></p>



<p>Let&#8217;s get your local linux system up to date:</p>



<ol class="wp-block-list"><li>Type <code>sudo apt update</code> then press enter.</li><li>Type in your local linux password (that you created earlier)</li><li><code>sudo apt upgrade</code>, then press <code>y</code> and enter when asked if you want to continue</li><li>It may take a little while, depending on the speed of your pc and internet connection.</li><li>Finally lets install ssh:<br><code>sudo apt install ssh</code></li></ol>



<p>Now we can connect to a remote linux computer:</p>



<p>If the username on the remote computer is the same as the one you created earlier, the command is:<br><code>ssh remotelinuxcomputer.example.com</code> or <code>ssh 192.168.2.1</code>, when you put in the computer&#8217;s name or ip address.</p>



<p>If the username is different, no problem, do this:<br><code>ssh joebloggs@remotelinuxcomputer.example.com</code><br>or<br><code>ssh joebloggs@192.168.2.1</code></p>



<p>In either case, you will probably get a warning about &#8220;the authenticity of the host xxxxx can&#8217;t be established&#8221;. Don&#8217;t worry, just type yes, then enter you password for the remote computer, and you&#8217;re in!</p>



<h2 class="wp-block-heading">One final tip</h2>



<p>If ssh into remote computers is all your do with this, then log out, the login command will be remembered by the shell, even if you reboot.<br>Next time you open the WSL terminal, press the &#8220;Up&#8221; as many times as you need to scroll through the command history and find the one you wanted.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sandyscott.net/2020/05/best-ssh-setup-for-windows/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
