Skip to content

Instantly share code, notes, and snippets.

@smuda
Created November 19, 2017 04:26
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save smuda/524af2a488b80b656e09a0e8142f1338 to your computer and use it in GitHub Desktop.
Save smuda/524af2a488b80b656e09a0e8142f1338 to your computer and use it in GitHub Desktop.
Setup SSH forwarding on QNAP NAS

On receiving NAS:

setcfg LOGIN "SSH AllowTcpForwarding" TRUE
reboot

On client to forward local port 8443 to the QNAP admin interface:

ssh user@host -L 8443:localhost:443
@the-moog
Copy link

Cool!! Thanks.
I've been trying to get VSCode remote working for ages to make it easier to work on https://github.com/the-moog/QNAP-QTS-Tools and this simple trick fixed it - thanks!!
Without this every time I restart the SSH or NAS the settings changed in sshd_config are reset and that stops VSCore/remote working.

@ax2009live
Copy link

👍
Thank you!

@andymadge
Copy link

Cool!! Thanks. I've been trying to get VSCode remote working for ages to make it easier to work on https://github.com/the-moog/QNAP-QTS-Tools and this simple trick fixed it - thanks!! Without this every time I restart the SSH or NAS the settings changed in sshd_config are reset and that stops VSCore/remote working.

I was trying to get VSCode Remote working and I found that I needed to also enable AllowAgentForwarding on the NAS, and I needed to sudo both setcfg commands on the Qnap:

sudo setcfg LOGIN "SSH AllowTcpForwarding" TRUE
sudo setcfg LOGIN "SSH AllowAgentForwarding" TRUE

After reboot I confirmed the values had stuck - these command both returned TRUE:

getcfg LOGIN "SSH AllowTcpForwarding"
getcfg LOGIN "SSH AllowAgentForwarding"

Then I deleted any old .vscode-server files from the Qnap:

rm -rf ~/.vscode-server/

Finally I set "remote.SSH.useFlock" to false (i.e. unticked) in VSCode

After this VSCode Remote connected properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment