[Solved] VSC To Work On My Files?

Pashovski

New Member
Joined
Apr 24, 2021
Messages
3
Reaction score
3
Credits
35
Hi!

I am brand new to Linux. I got an Intel NUC and installed Debian on it. Using docker-compose I set up containers for Home Assistant, Pi-Hole, InfluxDB, and Grafana.

One thing I would like to be able to do - and this is nothing personal against VI editor - is use VSC to connect to my Docker host just as if my files were on my local machine. I have found the docs here a little confusing. Step 1 of the tutorial, Remote via SSH , wants me to create a VM in Azure, which as far as I can tell costs money.

Is there a step-by-step tutorial for dummies on this? I tried YouYube, but it seems that most of the videos are outdated.
 


I also have a couple of NUCs I run Linux on.
Using vi takes a little time, there is a learning curve for sure. You might consider nano, pico or tilde.

You don't need to create a VM in Azure to do any of this. Yes it's $$$
Installing Azure CLI is a pain, and setting up the firewall (NSG) rules in Azure is even more of a pain.

This isn't a video, but the instructions are pretty straight forward.


Edit: Sorry read this wrong.. must be becoming dyslexic. You said VSC, not vcs.

 
Last edited:
In the link you posted it looks like the virtual machine is just the remote host they are connecting to, so you can just consider that you already have a virtual machine which is your remote host but I think it would be something like this.
1. From you local machine, open vscode and then install the extension "Remote SSH"
2. On your local machine, open a command-line and setup
3. Install a Windows openssh client
4. Open command-line prompt and setup a keypair: ssh-keygen -t rsa -b 4096
5. Login through ssh into your remote machine(Intel NUC with Debian)
6. Open the file following file with vim or nano: ~/.ssh/authorized_keys
7. Past the contents of your publickey(id_rsa.pub) in there and save it
8. Setup the permissions correctly just to be sure: chmod 600 ~/.ssh/authorized_keys
9. From you local Windows machine Open VScode: Click on green indicator at bottom left to bring up a list of remote connections and choose ssh.
10. Configure user and host details: Enter user and host details within the Vscode extension and at some point you will have to click on connect.
 
Last edited:
Wow Thanks for that! I learned a whole lot about Linux just now!

I apologize in advance for the bird brain question but I'm caught on step 6.
6. Open the file following file with vim or nano: ~/.ssh/authorized_keys
I ran this command nano ~/.ssh/authorized_keys , pasted the contents of my publickey(id_rsa.pub) and then when I save it says Error writing /home/pashovski/.ssh/authorized_keys: No Such file or directory

Maybe on my machine it's not created yet, or maybe I am looking in the wrong place?
 
Try creating it first and then opening it.
1. touch ~/.ssh/authorized_keys
2. nano ~/.ssh/authorized_keys

Or if you are comfortable enough with vim for such basic actions try using vim instead for that part, I never use nano but only used it since I thought it would be easier for you.

Does that work for you?
 
Last edited:
I forgot to mention the other option you have would be to create a git repository on gitlab.com or github.com pushing your source there. Then edit your changes locally on your local machine running Windows with VScode, after which you can then commit and push your changes to gitlab or github, so that you can than pull your changed code on your remote machine.
 
hi
Try creating it first and then opening it.
1. touch ~/.ssh/authorized_keys
2. nano ~/.ssh/authorized_keys

Or if you are comfortable enough with vim for such basic actions try using vim instead for that part, never use nano but only used it since I thought it would be easier for you.

Does that work for you?
YES! It is working. I don't know if it is perfect, but I changed some files via VSC and the changes were saved.

Thank you so much!!!
 
Glad you got it to work!
 

Members online


Top