Tutorial on SSH

(I’m just a fellow user, not an employee.)

This could indicate that your container’s /etc/passwd is missing, invalid, or doesn’t have a “root” user.

From your other post I see you are using “scratch” as the base image. It doesn’t include /etc/passwd and other basic things such as a shell, so Fly’s SSH server can’t support it. If you want SSH you need to switch to a base image that includes a basic working system (some examples: “alpine”, “busybox”).


I’m not sure if there is a good tutorial for this. Here is a minimal example (using Apache on Debian) if you want a starting point:

mkdir app && cd app
cat > Dockerfile <<"EOF"
FROM httpd
EOF
fly launch # accept the defaults
# set the internal port to 80 because that's what httpd listens on by default
patch fly.toml <<"EOF"
--- fly.toml.orig
+++ fly.toml
@@ -15 +15 @@
-  internal_port = 8080
+  internal_port = 80
EOF
fly deploy
wget -O - https://APP.fly.dev # replace APP with your app's name
fly ssh console

Yes.

No app configuration is required, but (as you discovered) you do need a basic working system.


Setting up SCP is a small hassle, I’m not sure if there is canonical documentation anywhere but it goes like this (source):

fly ssh issue --agent
fly proxy 10022:22 # stays in the foreground; run in a separate terminal
scp -P 10022 path/to/local/file root@localhost:/path/to/remote/dest

Note that this requires SCP to be installed in the app’s VM (e.g. add RUN apt-get update && apt-get install -y openssh-client to the Dockerfile, or install interactively using fly ssh console).

Alternatively, you can use flyctl’s built-in SFTP-like interactive shell, which doesn’t require any setup but is less powerful (e.g. can’t upload directories yet):

fly ssh sftp shell
put path/to/local/file /path/to/remote/file
3 Likes