@@ -232,7 +232,17 @@ These features are useful once you're comfortable.
232232
233233Use SSHFS to mount your Sprite and edit files with your local tools.
234234
235- ** Install SSHFS first:**
235+ ** Prepare an SSH server on your Sprite:**
236+
237+ ``` bash
238+ # Install OpenSSH
239+ sudo apt install -y openssh-server
240+
241+ # Create a service to automatically start it
242+ sprite-env services create sshd --cmd /usr/sbin/sshd
243+ ```
244+
245+ ** Install SSHFS on your local machine:**
236246
237247``` bash
238248# macOS
@@ -245,16 +255,25 @@ sudo apt-get install sshfs
245255sudo dnf install fuse-sshfs
246256```
247257
258+ ** Authorize your SSH public keys:**
259+
260+ ``` bash
261+ sprite exec mkdir -p .ssh
262+ cat ~ /.ssh/id_* .pub | sprite exec tee -a .ssh/authorized_keys
263+ ```
264+
248265** Add this helper to your shell config:**
249266
250267``` bash
251268# Add to ~/.zshrc or ~/.bashrc
252269sc () {
253- local sprite_name=" ${1 :- $(sprite use)} "
270+ local sprite_name=" $1 "
254271 local mount_point=" /tmp/sprite-${sprite_name} "
272+ test -n " $( sprite url -s " ${sprite_name} " ) "
255273 mkdir -p " $mount_point "
274+ sprite proxy -s " ${sprite_name} " 2000:22 &
256275 sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 \
257- " sprite@${sprite_name} .sprites.dev: " " $mount_point "
276+ " sprite@localhost: " -p 2000 " $mount_point "
258277 cd " $mount_point "
259278}
260279```
@@ -263,6 +282,7 @@ sc() {
263282
264283``` bash
265284umount /tmp/sprite-my-sprite
285+ kill " $( lsof -t -i:2000) "
266286# macOS may need: diskutil umount /tmp/sprite-my-sprite
267287```
268288
0 commit comments