R
RunPod•5mo ago
Sagar

connect ssh vscode to runpod gpu server

following the blog - https://blog.runpod.io/how-to-connect-vscode-to-runpod/ 1. I have created ssh key, and added public key to account 2. I have created pod with TCL port 22 3. accessing the pod via terminal, using and running following command to turn on the ssh connection bash -c "apt update;apt install -y wget;DEBIAN_FRONTEND=noninteractive apt-get install openssh-server -y;mkdir -p ~/.ssh;cd $_;chmod 700 ~/.ssh;echo YOUR_PUBLIC_KEY > authorized_keys;chmod 700 authorized_keys;service ssh start;sleep infinity" 4. then I am using vs code remote desktop extension to connect to server problem is it is asking for password
RunPod Blog
How to Connect VSCode To RunPod
While working in a terminal window is sometimes good enough, it's much nicer to work within your IDE if you are doing interactive development. Fortunately, you can connect your VSCode IDE to your RunPod instance via SSH. This will allow you to edit files and code on your remote instance
Solution:
Hey got it resolved, thanks for help I have wsl on my windows, I was creating a ssh key on wsl and ...
Jump to solution
13 Replies
Superintendent
Superintendent•5mo ago
then your ssh key isnt setup right
Sagar
Sagar•5mo ago
following following things to create ssh 1. Create a key pair in a terminal window as follows: ssh-keygen -t ed25519 Save it wherever you want, but remember the path! If this is your first/only SSH key, feel free to use the default path by pressing Enter without entering a custom path. 2. Get your public key (you can use the following command if you used the defaults) cat ~/.ssh/id_ed25519.pub 3. Copy your SSH key to the server. For RunPod, you can find the menu in your settings in the top right corner. then using terminal to add ssh key to authorized_keys I am able to connect to server however it asks for root password also is there easier way than this? I know there is template with vscode,however I want solution with existing templates. @justin can you help?
justin
justin•5mo ago
https://discord.com/channels/912829806415085598/1194711850223415348 Try to do this 🙂 Kill the pod btw But if u do it this way all pods moving forward ull have the ssh key pairing set up by doing the guide
Solution
Sagar
Sagar•5mo ago
Hey got it resolved, thanks for help I have wsl on my windows, I was creating a ssh key on wsl and While using remote it is looking at windows config
Sagar
Sagar•5mo ago
I created the public key on windows, resolved
justin
justin•5mo ago
Wow good to know Nice Imma add this to that section
Sagar
Sagar•5mo ago
Now vs code is connected, wanted to check if I can upload the files from there, any experience/suggestions
justin
justin•5mo ago
XD my…. discord link! hahaha i added an experimental send / download file wrapper around scp but yea just scp ur files over or u can use my wrapper that is added to their cli but scp is the best way to go, and if u have many small files to zip and send it
Sagar
Sagar•5mo ago
direct drag and drop also works
justin
justin•5mo ago
ah into vscode? does it do scp under the hood nice i didnt know that Great to know!
Sagar
Sagar•5mo ago
yes, available in vscode , I guess with TCL port it is possible
Ronalae
Ronalae•5mo ago
i still have the issue when following the blog "Go ahead and run the last SSH command in a terminal window to confirm that you are able to connect via SSH. Make sure that the path after "-i" points to the path where you saved/generated your public key." -> this will return "connection refused" in the terminal