# VSCode Remote ## Host SSH to virtual box ```bash sudo apt install -y openssh-server sudo service ssh status ssh junhao@192.168.56.1 -->Known_hosts ``` ## VSCode Remote Development - Admin cmd ``` C:\Users\howar>ssh-keygen -t rsa -b 4096 -f %USERPROFILE%/.ssh/ubuntu_rsa Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in C:\Users\howar/.ssh/ubuntu_rsa. Your public key has been saved in C:\Users\howar/.ssh/ubuntu_rsa.pub. The key fingerprint is: SHA256:WbT47VqgX3k8BLnfZhs/H9+3NAWnq+/+9ekvgDLcoec howar@DESKTOP-PG0AG2O The key's randomart image is: +---[RSA 4096]----+ | . | | o . . | | . o o . .| | +.. o + | | .Soooo o .| | =.+o.= o.| | .= =.*==| | .E+ oo=&| | o .+=B#| +----[SHA256]-----+ C:\Users\howar>scp -P 22 %USERPROFILE%/.ssh/ubuntu_rsa.pub junhao@192.168.56.1:~/key.pub junhao@192.168.56.1's password: ubuntu_rsa.pub 100% 748 380.0KB/s 00:00 ``` ```bash= junhao@junhao-VirtualBox:~$ ls Desktop Documents Downloads examples.desktop key.pub Music Pictures Public Templates Videos junhao@junhao-VirtualBox:~$ cat ~/key.pub >> ~/.ssh/authorized_keys junhao@junhao-VirtualBox:~$ chmod 600 ~/.ssh/authorized_keys junhao@junhao-VirtualBox:~$ rm ~/key.pub C:\Users\howar>ssh -i %USERPROFILE%/.ssh/ubuntu_rsa -p 22 junhao@192.168.56.1 Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-53-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage * Canonical Livepatch is available for installation. - Reduce system reboots and improve kernel security. Activate at: https://ubuntu.com/livepatch 0 packages can be updated. 0 updates are security updates. Your Hardware Enablement Stack (HWE) is supported until April 2023. Last login: Mon May 25 18:18:23 2020 from 10.0.2.2 Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-53-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage * Canonical Livepatch is available for installation. - Reduce system reboots and improve kernel security. Activate at: https://ubuntu.com/livepatch 0 packages can be updated. 0 updates are security updates. Your Hardware Enablement Stack (HWE) is supported until April 2023. Last login: Mon May 25 18:18:23 2020 from 10.0.2.2 ``` ## VSCode Remote config ```= Host remote     HostName 192.168.56.1     User junhao     Port 22     IdentityFile C:/Users/howar/.ssh/ubuntu_rsa ``` ```= .bashrc export NODE_OPTIONS="--max-old-space-size=8192" ``` ## SFTP config ```= "name": "My Server", "host": "192.168.56.1", "protocol": "sftp", "port": 22, "username": "junhao", "password": "6066", "privateKeyPath": "C:/Users/howar/.ssh/ubuntu_rsa", "remotePath": "/home/junhao/git", "uploadOnSave": false ```