title: How to enable X11 forwarding in PyCharm SSH session?
body: <h1>The Question</h1>
  
  <p>I'm trying to enable <strong>X11 forwarding</strong> through the <strong>PyCharm</strong> <em>SSH Terminal</em> which can be executed via </p>
  
  <pre><code>"Tools -&gt; Start SSH session..."
  </code></pre>
  
  <p>Unfortunately, It seems there is no way of specifying the flags like I would do in my shell for enabling the X11 Forwarding:</p>
  
  <pre><code>ssh -X user@remotehost
  </code></pre>
  
  <p><strong>Do you know some clever way of achieving this?</strong></p>
  
  <hr>
  
  <h1>Current dirty solution</h1>
  
  <p>The only dirty hack I found is to open an <em>external ssh connection</em> with X11 forwarding and than manually update the environment variable <strong>DISPLAY</strong>.</p>
  
  <p>For example I can run on my external ssh session:</p>
  
  <pre><code>vincenzo@remotehost:$ echo $DISPLAY
  localhost:10.0
  </code></pre>
  
  <p>And than set on my PyCharm terminal:</p>
  
  <pre><code>export DISPLAY=localhost:10.0
  </code></pre>
  
  <p>or update the <strong>DISPLAY</strong> variable in the <em>Run/Debug Configuration</em>, if I want to run the program from the GUI.</p>
  
  <p>However, <strong>I really don't like</strong> this solution of using an external ssh terminal and manually update the <strong>DISPLAY</strong> variable and I'm sure there's a better way of achieving this! </p>
  
  <p>Any help would be much appreciated.</p>
  
  <hr>
  
  <p>P.s. Making an alias like:</p>
  
  <pre><code>alias ssh='ssh -X'
  </code></pre>
  
  <p>in my <em>.bashrc</em> doesn't force PyCharm to enable X11 forwarding.</p>