#Easy Way to SSH to Pod / File Transfers
20 messages · Page 1 of 1 (latest)
Just sharing the doc to share what process of what is going on underneath the hood:
https://docs.runpod.io/docs/use-real-ssh
Basically the way I am sharing above is just doing the steps here, generating your private/public key, assigning your public key to your runpod, and then so on.
Establishing an SSH connection can be helpful b/c you can then do something like:
https://chat.openai.com/share/5f3ca32a-9c32-4ca2-a87e-bf1039bf44f3
Where you SSH into the pod, or from locally, you SCP something in and out of the server.
I also found that if you are still having trouble, like it asking you for a password prompt or something like that. It's b/c the public key wasn't properly loaded into the pod probably b/c it existed before you created the private/public key.
But I found if you did my steps + then you stop / start the server, and just run the tcp command it gives you it fixes it. For some reason the:
bash -c 'apt update;DEBIAN_FRONTEND=noninteractive apt-get install openssh-server -y;mkdir -p ~/.ssh;cd $_;chmod 700 ~/.ssh;echo "$PUBLIC_KEY" >> authorized_keys;chmod 700 authorized_keys;service ssh start;sleep infinity'
Didn't work for me putting it in the Docker command, which should have added all the public keys to the server again on restart, but I guess there was maybe an issue. But the other command worked.
Note if ur using WSL on Windows here is something u can watch out for if having issues:
@wintry rain could you plz explain what does this mean?
P.S These steps are for all NEW pods going forward after completion. Not existing pods.
@wintry rain also do you know by any chance how to use scp with Runpod?
@wintry rain i'm being asked for the password even though i stored the ssh key
@wintry rain stored the key from ~/.ssh/id_rsa.pub in /root/.ssh/authorized_keys
but when i send a directory like this
scp -i /root/.ssh/id_rsa -p 10308 -r 5700 [email protected]:/
it's asking for some fucking password:
[email protected]'s password:
This works amazing on all non-Runpod servers, on Runpod it does not
When going through the steps existing pods that are already running or stopped in the process will not have the public key that has been added to your account.
I did try to do it with the Docker run command for an existing pod with the below but it didnt really work for me - but theoretically it should have. Maybe can try the article urself / i did something wrong. But in the future the steps under ur settings > public key will auto be injected to new pods
Article:
https://docs.runpod.io/docs/use-real-ssh
bash -c 'apt update;DEBIAN_FRONTEND=noninteractive apt-get install openssh-server -y;mkdir -p ~/.ssh;cd $_;chmod 700 ~/.ssh;echo "$PUBLIC_KEY" >> authorized_keys;chmod 700 authorized_keys;service ssh start;sleep infinity'
—-
For future pods, if u are able to / u should be able to, run the runpod pod connect xxx
U can use my PR I made and install from my repository that has a wrapper around scp where u can do:
runpod pod send/download
The PR i made can be seen at the first top post in the second part where I write an additional edit steps
The basic terminal SSH access that RunPod exposes is not a full SSH connection and, therefore, does not support commands like SCP. If you want to have full SSH capabilities, then you will need to rent an instance that has public IP support and run a full SSH daemon in your Pod.Setup Generate your pu...
Is there any way to just use scp with no wrappers?
https://chat.openai.com/share/255a2db7-ea15-4662-9a65-008fe9bd5d6f
Yup! Chatgpt link about it cause I never remember the structure lol.
Thank you :)
Neat, I didn't know it could share stuff like this 🫶
@livid lily my best soltion was to make script that can auto setup ssh and setup password for full sftp in my case I also made auto connect file for filezilla
#🎤|general message
https://discord.com/channels/912829806415085598/1202555381126008852
Sharing a thread today for people who have ACTIVE running pods, who haven't set up SSH before, using Madiator's pip python repository to allow them to set up SSH / be able to SCP to it.
This is for future reference
Adding onto this for the situation between transfering files between two different pods:
- You can set up an SSH on two pods using Madiator's package where you just run:
pip install OhMyRunPod
OhMyRunPod --setup-ssh
cat /workspace/root_password.txt
``` on both pods
2) You can then use the SCP command:
For ex. a Pod's connection command might tell you to do:
SSH over exposed TCP: (Supports SCP & SFTP)
ssh [email protected] -p 11817 -i ~/.ssh/id_ed25519
U can use that as reference to build your SCP command, and since you don't need the -i flag to supply your private key since it expects you to login by password, you can actually do something like the following to send a file from one pod to another, or vice-versa to download:
scp -P 11817 /path/to/your/local/file.txt [email protected]:/path/where/you/want/to/put/file
SSH / SCP - (or even SFTP if you want to use that protocol), all need TCP port connections available, but with runpod's pods that should always be the case that you can configure that.
3) But let's say you want something similar to runpodctl but is taking too long:
https://discord.com/channels/912829806415085598/1207418596850925618
Looking at this thread, you can use something like **croc**, which is what runpodctl uses under the hood, but with their own relay servers, but by using croc just as a CLI, you can use their public relay servers, and people have had good success with this as seen in the thread.
https://github.com/schollz/croc
----
Take away:
SSH / SCP from one pod to another, allows you to have a **direct** connection, this is going to be one of the fastest speeds you are going to get. If you do ssh / scp, make sure to always zip up directories and so on, b/c file transfering multiple tiny files will always take exponentially longer.
But for similar experience to runpodctl, where you want just an easy CLI that is easy to setup, and just go, you can use croc and get good speeds out of it too.
Created a Github repo to talk about all of this so Im not limited to Discord pls read my new tips and information there:
https://github.com/justinwlin/Runpod-Tips-and-Tricks/tree/main/SSH On Runpod