title: VSCode in WSL: how to sudo a root file so I can edit it
body: <p>WSL v.1 -- VSCode v1.40.1 (using 'Remote - WSL' extension 40.3)</p>
  
  <p><strong>How to open a root-owned file for edit using sudo and VSCode? (without running as root)</strong></p>
  
  <p>If I open a root file without <code>sudo</code>, I can't edit it (expected):
      $ code /etc/profile.d/custom-profile.sh
      $</p>
  
  <p><a href="https://i.stack.imgur.com/eNsXK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eNsXK.png" alt="enter image description here"></a></p>
  
  <p>But, if I try to <code>sudo code</code> the file, I get:</p>
  
  <pre><code>$ sudo code /etc/profile.d/custom-profile.sh
  [sudo] password for xxxx:
  sudo: code: command not found
  </code></pre>
  
  <p>Binarify's answer below shows that I can switch the default user to <code>root</code>, but I definitely don't want to be running as root, so I'm still looking for another solution.</p>