ssh-connection-management
Skill2.3k starsChanged 5 months agoApache-2.0View on GitHub
Guides on establishing persistent master SSH multiplexing sockets at ~/.ssh/sockets/<TARGET_NAME>.sock using ssh -f -N -M -S, testing connection liveness, gracefully terminating via -O exit, removing stale control sockets, and recreating sockets when remote user permissions or groups change.
- Reads credentials
Trending
Quiet since September.about the whole repository
Who's talking about GoogleCloudPlatform/gcsfuse
- A Hacker News story“Gcsfuse: A user-space file system for interacting with Google Cloud Storage”Hacker News · Sep 6, 2023 · 152 points
- GoogleCloudPlatform/gcs-fuse-csi-driver“Built-in health check for GCS-FUSE-CSI-DRIVER”GitHub · May 15, 2024 · 5 reactions
- ondrajz/go-callvis“Got error running go-callvis on github.com/googlecloudplatform/gcsfuse”GitHub · Nov 21, 2023 · 3 reactions
- jacobsa/fuse“Operations frequently canceled when accessing a `gcsfuse` mount with a Go application”GitHub · May 26, 2022 · 3 reactions
- ofek/csi-gcs“Support max-retry-sleep gcsfuse flag”GitHub · Feb 23, 2021 · 3 reactions
The biggest 5 of 24 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 24
Talked about on GitHub, Hacker News and Bluesky (24 times).
On GitHub · 20
- May 15, 2024Built-in health check for GCS-FUSE-CSI-DRIVER — GoogleCloudPlatform/gcs-fuse-csi-driver5 reactions · 1 comment
- Nov 21, 2023Got error running go-callvis on github.com/googlecloudplatform/gcsfuse — ondrajz/go-callvis3 reactions · 8 comments
- May 26, 2022Operations frequently canceled when accessing a `gcsfuse` mount with a Go application — jacobsa/fuse3 reactions · 2 comments
- Feb 23, 2021Support max-retry-sleep gcsfuse flag — ofek/csi-gcs3 reactions · 4 comments
- Sep 17, 2026Enable gRPC by default via --enable-grpc-by-default and sidecar passthrough — GoogleCloudPlatform/gcs-fuse-csi-driver1 reaction · 4 comments
15 more on GitHub
- Aug 11, 2026Bump gcsfuse to v2.5.4-gke.4 to FIX CVEs — GoogleCloudPlatform/gcs-fuse-csi-driver1 reaction · 2 comments
- May 20, 2026update GCSFuse binary to 3.8.2 — GoogleCloudPlatform/gcs-fuse-csi-driver1 reaction · 2 comments
- Apr 27, 2026Add GCSFUSE_PR_NUMBER to support testing against a specific gcsfuse PR — GoogleCloudPlatform/gcs-fuse-csi-driversays it tested it1 reaction · 5 comments
- Sep 4, 2022Directories missing in GCS file_mounts — skypilot-org/skypilot1 reaction · 6 comments
- Feb 22, 2021Switch to specific gcsfuse tag — ofek/csi-gcs1 reaction · 4 comments
- Feb 21, 2019GCS connector sends a high volume of ListObjects requests, triggering GCS 429 throttling error — GoogleCloudDataproc/hadoop-connectors1 reaction · 13 comments
- Jul 9, 2018Mount GCE VM filesytems to GCS buckets — cloudyr/googleComputeEngineR1 reaction · 8 comments
- Feb 24, 2017Build fails when cross compiling for armv7 — kahing/goofys1 reaction · 2 comments
- Sep 2, 2026gcsfuse-mac 3.8.4 — gromgit/homebrew-fuse0 reactions
- Jul 24, 2026gcsfuse-mac 3.11.2 — gromgit/homebrew-fuse0 reactions
- Apr 4, 2024gcsfuse v2.0 — DataBiosphere/dsub0 reactions · 1 comment
- May 23, 2023Retracting go module is not working — arungudelli/Retract-Go-Module-Versions0 reactions
- Dec 31, 2021I have been playing with gcsfuse for today I haven't been able to get it to run on my mac. I have installed view brew and followed the instructions and get the following: — lucyt245/HTML-refresh0 reactions · 1 comment
- Aug 10, 2018google drive fuse — mahmoudimus/remote-box0 reactions
- Nov 16, 2016Add rate limiting feature — ovh/svfs0 reactions · 1 comment
On Hacker News · 2
- Sep 6, 2023Gcsfuse: A user-space file system for interacting with Google Cloud Storage152 points · 71 comments
- May 6, 2015Gcsfuse1 point
On Bluesky · 2
- Sep 10, 2023Google Cloud Storage(GCS)のバケットをLinux上でマウントするためのツール。FUSEを利用。Go実装。 — @matsuu.bsky.social1 likes and repost
- Apr 19, 2025this one: github.com/GoogleCloudP... ? — @handle.invalid0 likes and reposts · 1 reply
In this repository4 other files it gives its agents.
- buildSkill
- dep-upgradeSkill
- gcsfuse-integration-testingSkill
- pull-requestSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 42
Ensure local socket directory exists:
- Distinctive: line 49
Before starting a master connection, gracefully terminate any active master SSH daemon associated with the target to avoid leaving orphaned …
- Distinctive: line 70
Test remote command execution over the master socket:
- Very specific: line 77
If user permissions or group memberships change on the remote VM (e.g., after usermod -aG <group>):
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SSH Connection Management
This skill guides you through establishing, managing, and troubleshooting persistent SSH socket multiplexing connections to target GCE VMs or remote VMs. Socket multiplexing speeds up command execution and maintains session resilience across automated workflow steps such as remote testing, benchmarking, or environment management.
Prerequisites & Trigger Conditions
Prerequisites
- GCP Compute SSH Keys: Local SSH key pair present at
~/.ssh/google_compute_engine(or standard~/.ssh/id_rsa). - GCP Authentication: Local
gcloudauthenticated with compute viewer/admin permissions. - Network Reachability: Internal IP or hostname reachability to target VM (e.g.
nic0.<VM_NAME>.<ZONE>.c.<PROJECT_ID>.internal.gcpnode.comor<REMOTE_HOST>). - OpenSSH Client: Local OpenSSH client supporting ControlMaster options (
-M,-S).
Trigger Conditions
- Executed prior to running remote commands, setup scripts, conformance test suites, benchmarking, or environment management on target GCE or remote VMs.
- Triggered when SSH connections fail due to stale socket files ("Control socket connect failed").
- Triggered when user permissions or group memberships on target VM are modified requiring session group ID refresh.
Input/Output Contract
Inputs
- Target Connection Details:
- Target Name (
<TARGET_NAME>, e.g.,gce-c4-ssdor target VM identifier). - VM Name (
<VM_NAME>). - Zone (
<ZONE>). - GCP Project ID (
<PROJECT_ID>). - SSH User (
<SSH_USER>).
- Target Name (
- Socket Cache Directory:
~/.ssh/sockets/.
Outputs
- Active Master Socket File: Unix domain socket located at
~/.ssh/sockets/<TARGET_NAME>.sock. - Background SSH Process: Persistent background
ssh -f -N -Mprocess holding the master channel open.
Step-by-Step Procedure
Step 1: Create Socket Cache Directory
Ensure local socket directory exists:
mkdir -p ~/.ssh/socketsStep 2: Clean Up Lingering Sessions and Stale Sockets
Before starting a master connection, gracefully terminate any active master SSH daemon associated with the target to avoid leaving orphaned background processes in memory, and remove any broken or stale socket file:
ssh -O exit -S ~/.ssh/sockets/<TARGET_NAME>.sock <SSH_USER>@nic0.<VM_NAME>.<ZONE>.c.<PROJECT_ID>.internal.gcpnode.com 2>/dev/null || rm -f ~/.ssh/sockets/<TARGET_NAME>.sockStep 3: Establish Master SSH Connection
Launch the persistent master SSH connection in the background (forks immediately via -f):
ssh -f -N -M -S ~/.ssh/sockets/<TARGET_NAME>.sock -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/google_compute_engine <SSH_USER>@nic0.<VM_NAME>.<ZONE>.c.<PROJECT_ID>.internal.gcpnode.comKey options explained:
-f: Requests ssh to go to background just before command execution (forks into background).-N: Do not execute a remote command (background connection mode).-M: Place the SSH client into master mode for connection sharing.-S ~/.ssh/sockets/<TARGET_NAME>.sock: Path to the control socket.-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null: Prevent interactive host key prompts.
Step 4: Verify Connection Liveness
Test remote command execution over the master socket:
ssh -S ~/.ssh/sockets/<TARGET_NAME>.sock -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/google_compute_engine <SSH_USER>@nic0.<VM_NAME>.<ZONE>.c.<PROJECT_ID>.internal.gcpnode.com "echo 'Connection Alive'"Step 5: Refreshing / Recreating Sockets
If user permissions or group memberships change on the remote VM (e.g., after usermod -aG <group>):
- Gracefully terminate the active master SSH session and clean up the socket file:
ssh -O exit -S ~/.ssh/sockets/<TARGET_NAME>.sock <SSH_USER>@nic0.<VM_NAME>.<ZONE>.c.<PROJECT_ID>.internal.gcpnode.com 2>/dev/null || rm -f ~/.ssh/sockets/<TARGET_NAME>.sock - Re-establish the master connection by repeating Step 3.
Failure Modes & Edge Cases
| Failure Scenario | Root Cause | Remediation / Recovery Action | ||
Control socket connect failed: Connection refused | Master SSH process died unexpectedly, leaving a dead socket file | Gracefully exit or remove stale socket file (`ssh -O exit -S ~/.ssh/sockets/<TARGET_NAME>.sock <SSH_USER>@<HOST> 2>/dev/null | rm -f ~/.ssh/sockets/<TARGET_NAME>.sock`) and re-run master connection command. | |
Permission Denied (publickey) | SSH key ~/.ssh/google_compute_engine missing or expired GCP IAM SSH login credentials | Run gcloud compute config-default-ssh-keys or gcloud compute ssh <VM_NAME> --zone=<ZONE> to refresh SSH keys. | ||
| Permission / Group Refresh Delay | User added to a new group or permissions modified, but commands fail with permission errors | Active SSH master session retains original user and group IDs. Gracefully exit master session (`ssh -O exit -S ~/.ssh/sockets/<TARGET_NAME>.sock <SSH_USER>@<HOST> 2>/dev/null | rm -f ~/.ssh/sockets/<TARGET_NAME>.sock`), and start new master SSH socket. | |
| Connection Drop / Network Disconnect | Remote VM rebooted or network path reset | Gracefully exit master socket if responsive (`ssh -O exit -S ~/.ssh/sockets/<TARGET_NAME>.sock <SSH_USER>@<HOST> 2>/dev/null | rm -f ~/.ssh/sockets/<TARGET_NAME>.sock`), and re-establish master SSH connection. |
Verification Checks
- Local Socket File Check: Confirm socket file exists and is an active socket file:
test -S ~/.ssh/sockets/<TARGET_NAME>.sock && echo "SOCKET_EXISTS" - Remote Echo Check: Confirm commands execute over multiplexed socket:
ssh -S ~/.ssh/sockets/<TARGET_NAME>.sock -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.ssh/google_compute_engine <SSH_USER>@nic0.<VM_NAME>.<ZONE>.c.<PROJECT_ID>.internal.gcpnode.com "echo 'Connection Alive'" - Graceful Teardown Check: Confirm graceful termination of the master socket:
ssh -S ~/.ssh/sockets/<TARGET_NAME>.sock -O exit <SSH_USER>@nic0.<VM_NAME>.<ZONE>.c.<PROJECT_ID>.internal.gcpnode.com
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

