Visual Studio Code Remote Development through SSH

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024
  • How to setup the Remote Development extension from Microsoft in VS Code, for remote development on a Linux server (at this time, you need to use a x64 machine). As a demo of the workflow, I show how to debug a dummy C program.
    First part of the video shows the setup in detail on a Windows machine, after which I demo how to debug a C program, last part of the video briefly shows the setup on a Linux machine. I recommend to watch the entire video even if you are on a Linux machine because the Windows part contains more explanations.

Комментарии • 107

  • @abhijitd80
    @abhijitd80 4 года назад +6

    I was having issues connecting VSCode to server through SSH and tried so many things yesterday. Nothing worked. Now from this video, I found that I need to add Port and full address of the private key to be able to connect successfully. Thanks a lot!

  • @charlesalleyne7711
    @charlesalleyne7711 4 года назад +6

    Thanks for providing the step-by-step instructional video. Now I have my Visual Studio Code (Machine Learning Models) running on AWS for overnight training and don't have to worry about losing connection and the system prompting me for a password while I get my much needed sleep.

  • @momq1434
    @momq1434 4 года назад +5

    OMG, It works finally, I saw so many tutorials and yours is the best. Thank you for sharing.

  • @GfastGao
    @GfastGao 5 лет назад +5

    I've checked out this video each time when I'd like to connect to a new server.

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  5 лет назад

      Thanks, glad my tutorial is helpful. BTW, since you are a subscriber to my channel, you can send me suggestions for new tutorials and, assuming I'm familiar with the subject, I will make a short video.

    • @GfastGao
      @GfastGao 5 лет назад

      @@AtoZProgrammingTutorials On my Bench right now, the most interesting question I can think of, is a way to version control my mySQL database. As you may know, it need such a huge mount of tweak after the first implementation of my database structure. But it is so damm hard to version control it like using git.

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  5 лет назад +1

      I don't have something specific about using version control with a mySQL database. I tend to save backups periodically.

  • @ashishkedarisetti6573
    @ashishkedarisetti6573 3 года назад +2

    After trying so hard finally found the solution

  • @codeanster
    @codeanster 3 года назад +1

    Method works great in 2021! Easy to follow

  • @rahultino
    @rahultino 3 года назад +5

    Very nice tutorial. One observation. On my Windows 10 machine on VS Code the config file required me to use \ in the IdentityFile to indicate the path to the private key. When I used /, it did not work. When I changed all the / to \, it worked.

  • @takudzwamupanesure7765
    @takudzwamupanesure7765 3 года назад +1

    Thanks a lot it worked, I've been trying for so long, you saved my life.

  • @petersteiner2306
    @petersteiner2306 3 года назад +3

    great tutorial, everything worked on 1st attempt! thanks!

  • @michalroesler
    @michalroesler 2 года назад

    Please enable "Return RUclips Dislike" add-on for your RUclips account. This is what serious youtubers do. And I'm sure You are serious youtuber, because your video helped me a lot.

  • @jackiecagliosgostro2470
    @jackiecagliosgostro2470 3 года назад +3

    Really great help man! Appreciate it!

  • @zhangzheng150
    @zhangzheng150 4 года назад +2

    Simple, clear tutorial, super like

  • @andycordell3784
    @andycordell3784 4 года назад +1

    Thanks for making this video. Exactly what I needed!

  • @Shubham4u7
    @Shubham4u7 5 лет назад +3

    Worked like a charm! Thank you!

  • @mariustamdemtokam3435
    @mariustamdemtokam3435 4 года назад +3

    Very neat! Thank you for the step by step setup 👍

  • @khronaki
    @khronaki 4 года назад +2

    thank you!
    it worked :)
    I just had to switch back to version 0.49.0 of Remote - SSH because there is an issue with newer versions and it could not connect.

  • @marcelogando2354
    @marcelogando2354 3 года назад +1

    You helped me a lot. Thank you!!!

  • @smjure
    @smjure 4 года назад +1

    very nice, thanks

  • @DmitrySharabin
    @DmitrySharabin 5 лет назад +2

    Thank you! Really useful.

  • @Mohamed-Maghrebi
    @Mohamed-Maghrebi Год назад

    Thanks, It helped me to connect always without password, it was tirring hahaha

  • @dcastroazkra
    @dcastroazkra 3 года назад +1

    Thank you!

  • @enzotechcomputersolutions8075
    @enzotechcomputersolutions8075 2 года назад +1

    how did you configure the Linux side server so that the windows side
    can connect at the specified IP address and pot 2222?

  • @estupidoParapente
    @estupidoParapente 4 года назад

    Short and smart!
    thank you!

  • @ronaldobastos3210
    @ronaldobastos3210 4 года назад +1

    This video help me a lot. tks!!!

  • @tanishtyagi1301
    @tanishtyagi1301 3 года назад

    you are the best

  • @aditikaushik3073
    @aditikaushik3073 3 года назад

    Thanks a lot Sir ! :)

  • @farhodkalonov9370
    @farhodkalonov9370 2 года назад

    How would you connect with hmac-sha2-256 algorithm? I have tried MACs hmac-sha2-256 in config file , unfortunately didn't work.

  • @yandarcy7567
    @yandarcy7567 5 лет назад +1

    Great guide to Vs code remote workflow! :) BTW, the Windows you are showing is Windows Sandbox?

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  5 лет назад

      No, I did the recording on an insiders version of Windows that runs in a VM. I will use the Sandbox when I will the get the update to 1903, on my main computer, later this month.

    • @yandarcy7567
      @yandarcy7567 5 лет назад

      @@AtoZProgrammingTutorials Get, Thank you for your video and reply. I am setting my Vs code environment, hope it works. :)

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  5 лет назад

      @@yandarcy7567 If you'll have any problem just ask and I will try to help (if I can).

  • @iamabhishekanupam
    @iamabhishekanupam 2 года назад +1

    If after doing all this, it takes time to connect to the remote server or fails, install an older version of Remote SSH extension v0.49.0. There seems to be some issue in the newer version.

  • @ruksharalam173
    @ruksharalam173 2 года назад

    it works thanks!

  • @jc9101
    @jc9101 2 года назад

    Thank you.

  • @WolfVK-dh4jv
    @WolfVK-dh4jv 3 года назад

    clean

  • @NunoBatista88
    @NunoBatista88 4 года назад

    This helped me, thanks!

  • @nielsvansteen9087
    @nielsvansteen9087 3 года назад +1

    I hope I help somebody with this someday, But mine wasn't working at first and I spent 2 hours to fix it.
    I could generate the key, copy it and login to my server via windows cmd build in ssh. But when I tried connecting with VSC insiders it wouldn't work. it said 'can''t establish connection' or something like that.
    The problem was when you select

  • @oussamakarem5744
    @oussamakarem5744 Год назад

    For me it still always ask for Password and select OS type manually😓. any idea?

  • @coder3101
    @coder3101 5 лет назад

    Every is okay except that the not all extension that are installed in VS code are installed on Remote machine. Themes and snippets are installed only on local machine

  • @Thomas-ix7xq
    @Thomas-ix7xq 4 года назад

    Do I have to install something else than git on the remote server? When I try to connect it loads very long and then the messages "Could not fetch remote environment" and "Failed to connect to the remote extension host server (Error: Time limit reached)" appear.
    Connecting to the server with the Windows Terminal and the same credentials works without trouble.
    I've also tried to connect to an other server and it worked on this. That's why I assume the problem is on the server and not on my client but I just can't figure out what it is.

  • @yboujraf
    @yboujraf 3 года назад

    Dear Thank you,
    What about when the user is not "root" or be part of "root"
    I have this error message when I try to update a file
    Failed to save '__manifest__.py': Unable to write file 'vscode-remote://ssh-remote+7b22686f73744e616d65223a224f646f6f3133227d/odoo/custom/account-financial-tools/account_asset_batch_compute/__manifest__.py' (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/odoo/custom/account-financial-tools/account_asset_batch_compute/__manifest__.py')

  • @zaryabbaloch5266
    @zaryabbaloch5266 4 года назад

    Thanks alot for this wonderful tutorial, i have one question though. My vs code command terminal after connection with remote machine takes too long to connect. whats the issue

  • @lennard4454
    @lennard4454 3 года назад

    i set up vs code and server how you said. I Am able to connect with key, but when trying with vs code it just sais connection was cancelled although port, host, identityfile and user are set correctly

    • @lennard4454
      @lennard4454 3 года назад +1

      Wow, i now the solution. There is this little pop up window where you need to select linux for the server. When doing not, it fails after a few seconds

  • @ShubhamKumar-ws3lo
    @ShubhamKumar-ws3lo 2 года назад

    Thanks it's a nice video. Could we do this for internal ip address ?

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  2 года назад

      Yes, I actually used an internal IP in the video too, it was running on a separate computer in my network. It works even for virtual machines as long as these are connected to your internal network.

  • @gurdevrana5917
    @gurdevrana5917 4 года назад

    I am getting Connection error Version mismatch client refused..Any advice guys??

  • @andregoncalvesee
    @andregoncalvesee 4 года назад

    HI. I've been trying without success. Hope you can give me your feedback.
    Firstly I couldn't find the directory .ssh on home/User/ (said: file or directory does not exist). Therefore I decided to create the directory using the following command: mkdir -m 700 ~/.ssh
    From there everything was OK, but when do 'Remote-SSH: Connect to host' in VSC it opens a new window and after a while reports me: "Could not establish connection to "debian_remote". Connecting was canceled."
    Do you have any idea?

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  4 года назад

      Try to login directly, using ssh from a Terminal, to the remote machine and see if you can. You should be able to login using something like ssh -i your_key user_name@remote_ip
      If you have problems doing it manually (ssh in a Terminal), VS Code will have the same problem.

    • @andregoncalvesee
      @andregoncalvesee 4 года назад

      @@AtoZProgrammingTutorials By the terminal was working perfectly, ie it was not asking by the password. I read here, github.com/microsoft/vscode-remote-release/issues/2545, and did the downgrade of 'Remote - SSH' and then it is working. However, in VSC is always iasking by password (by terminal not).

    • @wiwikkarlina4447
      @wiwikkarlina4447 4 года назад

      @@AtoZProgrammingTutorials i have the same problem too .- couldnt find directory .ssh on home/user. what do i miss?

  • @ShinAkuma
    @ShinAkuma 3 года назад

    I get a "bash not found" error.

  • @pono3863
    @pono3863 5 лет назад

    I need some help, my insiders cannot connect to my VM it told me that it's unreachable, i'm using a ubuntu x64 i686

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  5 лет назад

      It is possible that your VM is not visible from outside or that you need to open some ports. I have a video about installing Debian 9 in VirtualBox, in which I also show how to open the VM for external ssh connections. If you are using VirtualBox, it should work the same way with Ubuntu. For other virtual machine infrastructures I can't really help.

    • @pono3863
      @pono3863 5 лет назад +1

      @@AtoZProgrammingTutorials I've figured out my problem, my VM was on i686 (32bit ubuntu), I changed it to 64_86x and it worked! you should indicate in the description which VM configuration use!
      Thanks for the reply and the tutorial, it was really helpful!

  • @primech2082
    @primech2082 5 лет назад

    Thank you~!! Really useful. I can not connect to the hosting server and I get an error,
    Can I use remote-ssh in a shared hosting environment instead of a server?

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  5 лет назад

      I'm not sure about the shared hosting environment. Personally I've tried on my local network connected to other Linux VMs or computers. I've also tried it with a VPS on Digital Ocean (it is like $5 per month) and it worked. The extension installs some code on the remote machine so I'm not sure if a shared hosting provider will let you install anything through SSH.

    • @primech2082
      @primech2082 5 лет назад

      @@AtoZProgrammingTutorials Thank you for your answer.
      I contacted you because I was not able to connect in the hosting (siteground-growbig) environment.
      I'll let you leave information here later.

  • @jallwork
    @jallwork 4 года назад

    Sorry - this doesn't work for me. After cat ~/key.pub >> /.ssh/authorized_keys , I get the error message "-bash: /.ssh/authorized_keys: No such file or directory" There is no .ssh directory. I can't see one anywhere on my raspberry pi

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  4 года назад

      You are missing a ~ tilda see ruclips.net/video/lKXMyln_5q4/видео.html

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  4 года назад

      Also, feel free to subscribe to my channel for future RPi videos.

    • @jallwork
      @jallwork 4 года назад

      @@AtoZProgrammingTutorials Thanks I'll try again

    • @jallwork
      @jallwork 4 года назад

      I missed the tlda in the text above, not in the command I typed to the pi. I've tried again. Here's a copy:
      ssh-keygen -t rsa -b 4096 -f %USERPROFILE%/.ssh/debian_rsa
      scp %USERPROFILE%/.ssh/debian_rsa.pub pi@192.168.1.22:~/key.pub
      ssh pi@192.168.1.22
      pi@raspberrypi:~ $ cat ~/key.pub >> ~/.ssh/authorized_keys
      -bash: /home/pi/.ssh/authorized_keys: No such file or directory
      pi@raspberrypi:~ $ ls .ssh
      ls: cannot access '.ssh': No such file or directory
      It looks like the files aren't copied across. There is no .ssh or known_hosts folder. There is a key.pub file though

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  4 года назад

      Can you connect to your RPi through ssh from the Windows machine manually ? If yes and you still don't have a .ssh folder (which is a bit strange), try to create one:
      cd ~ && mkdir .ssh
      After this try again.

  • @ShodhanKumar
    @ShodhanKumar 5 лет назад

    Hi , thanks for the informational video , i got the the popup window but with an error at the end says "Failed to connect to the remote extension host server (Error: Connection error: Unauthorized client refused)", any help is appreciated!

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  5 лет назад

      This sounds like an error during the SSH connection. Can you connect to the remote machine from the command line directly, without writing your password ?

    • @nathanoyama8477
      @nathanoyama8477 5 лет назад

      @@AtoZProgrammingTutorials I followed this instruction and got the same issue. I have generated an RSA key from my Windows 10 laptop
      PS C:\Users
      athan> ssh -i C:\Users
      athan\.ssh
      athan-windows_rsa nate@172.0.0.100
      nate@172.0.0.100's password:
      but it still asks me for the password to log into the remote Linux server via SSH.
      Also the ssh command doesn't work on CMD so I worked on PowerShell 5 and WSL but both returns the same error:
      "Can't connect to nathan-linux: unreachable or not Linux x86_64 (C:\\Users\
      athan/.ssh/config: terminating, 1 bad configuration options)
      Source: Remote - SSH (Extension)
      I am using
      * Windows 10 Build 18362 w/ SSH Client
      * Visual Studio Code - Insider 1.36.0-insider
      - Remote - SSH 0.42.2
      * CentOS 7.6 x86_64 (satisfies the packages and kernel version requirement)

  • @carlilez
    @carlilez 4 года назад

    I still cant get it connected. I keep getting Resolver error: The process tried to write to a nonexistent pipe

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  4 года назад

      Do you have more than one version of SSH installed on your Windows ? My video assumes that you are using the SSH that comes with Windows 10.
      Also try to connect to the target server from a Command Prompt, if it does not work or if you are asked for the password you (probably) have a problem with the way your SSH key was configured.

    • @kunalprasad1774
      @kunalprasad1774 4 года назад

      me too getting the same error

    • @kunalprasad1774
      @kunalprasad1774 4 года назад

      @@AtoZProgrammingTutorials My ssh key is configured properly only as I am able to ssh to the server without password with the help of key.But by visual studio,it;s coming that the process tried to write to a nonexisting pipe.
      Do I need to run pdb(python debugger) server on some port on the server as It seems that I am sending some data but there is no receiver on the server to get the instruction..
      Please help me out.I have got stucked as there are too much dependencies and so I am not able to run the code in my local system.
      Only way seems to me as remote debugging.

  • @billiemead1967
    @billiemead1967 5 лет назад

    Hmmm.... I keep trying:
    ssh-keygen -t rsa -b 4096 -f %USERPROFILE%/vscode_rsa
    but Windows 10 throws error: TOO MANY ARGUMENTS

  • @kenjimaeda2443
    @kenjimaeda2443 3 года назад

    Problem is with RPi. I need install something?

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  3 года назад

      Do you plan to connect to your RPi through SSH using VS Code ? If this is the case, it should normally work. You need to make sure first that you can use your Terminal to connect through SSH to the RPi using the SSH key.

    • @kenjimaeda2443
      @kenjimaeda2443 3 года назад

      @@AtoZProgrammingTutorials i can conected but Vs Code dont regonize Rpi

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  3 года назад +1

      I did a quick search on the Internet, plenty of people are using VS Code to do remote development on their RPi. You are missing a step or something. What is your main operating system the one on which you run VS Code ?

    • @kenjimaeda2443
      @kenjimaeda2443 3 года назад

      @@AtoZProgrammingTutorials I am using Linux, but Thanks you

  • @lucasmartins6914
    @lucasmartins6914 5 лет назад

    Connection refused whats??

  • @xadeat
    @xadeat 5 лет назад

    3:17 ls: cannot access .ssh: No such file or directory
    what should I do?

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  5 лет назад

      Double check that you are in the proper directory. .ssh is located in your user "home" folder.

    • @xadeat
      @xadeat 5 лет назад

      @@AtoZProgrammingTutorials now I can't login to server, access denied
      before it I can login,
      how to reset it?

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  5 лет назад

      @@xadeat I can't possibly know what you did on/with your server, so I can't give you any advice on this.

    • @xadeat
      @xadeat 5 лет назад

      @@AtoZProgrammingTutorials
      I'm not finished step until 3:17, my computer was restarted.
      Then I try to connect again to server then access denied

    • @xadeat
      @xadeat 5 лет назад

      I can't found key.pub in my server, where is it?

  • @berrycat4605
    @berrycat4605 4 года назад

    bad owner or permissions on C:/Users/

  • @donatelodonatelo383
    @donatelodonatelo383 Год назад

    salut romane

  • @lennard4454
    @lennard4454 3 года назад

    Why never put the commands in the desciption ;/

    • @TheBestestpercy
      @TheBestestpercy 3 года назад

      I don't know so you watch more? I kind of find it stupid but sometimes people just forget I don't really like it but it is how it is also there might be no commands.

  • @maxime.blanquart
    @maxime.blanquart 3 года назад

    Thank you dude ;)

  • @sadlove97
    @sadlove97 5 лет назад

    hi , how to add private key with passphrase bro

    • @AtoZProgrammingTutorials
      @AtoZProgrammingTutorials  5 лет назад

      It should be a setting that lets you see the console output in the remote extension. I think it is remote.SSH.showLoginTerminal (I don't remember exactly the name), but this will let you write the passphrase.