Skip to content

Commit 1aaa46e

Browse files
committed
Update SSHFS instructions following feedback
1 parent 95db7fa commit 1aaa46e

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

src/content/docs/working-with-sprites.mdx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ These features are useful once you're comfortable.
232232

233233
Use SSHFS to mount your Sprite and edit files with your local tools.
234234

235+
Sprites don't expose SSH directly—you'll need to install an SSH server on your
236+
Sprite and tunnel the connection through `sprite proxy`. This keeps your Sprite
237+
secure while still allowing local filesystem access.
238+
235239
**Prepare an SSH server on your Sprite:**
236240

237241
```bash
@@ -259,33 +263,38 @@ sudo dnf install fuse-sshfs
259263

260264
```bash
261265
sprite exec mkdir -p .ssh
262-
cat ~/.ssh/id_*.pub | sprite exec tee -a .ssh/authorized_keys
266+
sprite exec bash -c "echo '$(cat ~/.ssh/id_*.pub)' >> .ssh/authorized_keys"
263267
```
264268

265269
**Add this helper to your shell config:**
266270

267271
```bash
268272
# Add to ~/.zshrc or ~/.bashrc
269-
sc() {
273+
spritemount() {
270274
local sprite_name="$1"
271-
local mount_point="/tmp/sprite-${sprite_name}"
272-
test -n "$(sprite url -s "${sprite_name}")"
275+
local mount_point="/tmp/sprite-mount"
273276
mkdir -p "$mount_point"
274-
sprite proxy -s "${sprite_name}" 2000:22 &
277+
if pid=$(lsof -t -i :2000); then
278+
read -rp "A Sprite is already mounted, unmount it? (y/n) " yn
279+
[ "$yn" == "y" ] || return 1
280+
kill $pid && umount "$mount_point"
281+
fi
282+
sprite proxy -s "$sprite_name" 2000:22 &
283+
sleep 1 # wait for the proxy to start
275284
sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 \
276285
"sprite@localhost:" -p 2000 "$mount_point"
277-
cd "$mount_point"
286+
cd "$mount_point" || return 1
278287
}
279288

280-
# Mount the sprite with "sc my-sprite"
289+
# Mount the sprite with "spritemount my-sprite"
281290
```
282291

283292
**Unmount when done:**
284293

285294
```bash
286-
umount /tmp/sprite-my-sprite
287-
# macOS may need: diskutil umount /tmp/sprite-my-sprite
288-
kill "$(lsof -t -i:2000)"
295+
umount /tmp/sprite-mount
296+
# macOS may need: diskutil umount /tmp/sprite-mount
297+
kill $(lsof -t -i:2000)
289298
```
290299

291300
### Common Error Scenarios

0 commit comments

Comments
 (0)