whoami
Lucas Jenß
cat /etc/motd
The Coding Journal ツ — Notes taken on an epic coding journey. Technical solutions, debugging notes, and practical guides from the trenches of software development.
ls -la ~/languages/
- drwxr-xr-x
- ▶ PHP
- ▶ Ruby
- ▶ Scala
- ▶ C#
- ▶ JavaScript
- ▶ Objective-C
- ▶ Shell Scripting
ls -la ~/toolchain/
- drwxr-xr-x
- ▶ Typo3
- ▶ Akka
- ▶ Capistrano
- ▶ Git
- ▶ MAMP
- ▶ Adobe Illustrator
- ▶ NSTrackingArea (Cocoa)
uname -a
- drwxr-xr-x
- ▶ Mac OS X
- ▶ Unix
Troubleshooting Capistrano Missing SSH Keys
Capistrano deployments often get partway through before authentication breaks. A later Git operation may fail because the remote account cannot read the SSH key it expects. Other runs stop earlier with Permission denied (publickey), Could not open a connection to your authentication agent, or Identity file ... not accessible. These messages resemble one another, but each points to a different part of the connection chain.
The key distinction is between the private key on your workstation and the public key authorised on the destination server. Capistrano also uses SSH beyond its own server connection, especially when Git fetches a repository. Diagnosing those hops separately prevents a working target login from masking a broken repository login. That matters for Australian teams whose production systems may sit in Sydney while developers work from Melbourne, Brisbane, Perth or a shared office.
Identify the exact stage of failure
Start with cap production deploy -vvv and preserve the last successful task before the error. Capistrano's SSHKit output usually shows whether the failure happened while opening the server session, running a remote command, or cloning the repository. A git clone error may therefore be the first visible symptom of an SSH problem that began with the deploy user.
Read the error literally. Permission denied (publickey) means the server rejected the offered key. Could not open ... authentication agent means the local client had no agent available. An absent IdentityFile is a path or configuration problem. Host key verification failed is different: it concerns trust of the server's host key and should never be fixed by disabling verification blindly.
Separate local and remote checks before changing configuration. Confirm that your own SSH session reaches the deploy host, then test repository access as the same remote user. Also note whether the run was launched from a terminal, an IDE task, tmux, or CI, because each can expose a different environment and SSH variables.
Reproduce the SSH connection outside Capistrano
Run a verbose, non-interactive probe using the exact key path you intend to use: ssh -vvv -T -i ~/.ssh/id_ed25519 deploy@app.example.com.au. The -T option avoids opening a shell, while -vvv shows which keys were offered, which agent was contacted, and which authentication methods the server permitted. A successful probe narrows the fault to Capistrano, SSHKit, or an inherited environment.
Inspect effective SSH configuration with ssh -G app-prod when production uses a host alias. Check hostname, user, identityfile, identitiesonly, and identityagent against your ~/.ssh/config. A Host block that does not match the name passed by Capistrano will be ignored, including any IdentityFile inside it.
Use forced identity selection to compare behaviour: ssh -o IdentitiesOnly=yes -i ~/.ssh/id_ed25519 -T deploy@app.example.com.au. If that works but the normal command fails, suspect agent contents, key discovery, or configuration precedence rather than the remote account. The broader project background behind these experiments is recorded on Oscar's site, complementing the command-focused notes here.
Check agent access and key permissions
ssh-add -l shows whether an agent is available and which public keys it holds. An empty result or “The agent has no identities” calls for starting or reconnecting to an agent, then adding the private key with ssh-add ~/.ssh/id_ed25519. A passphrase prompt is expected and safer than storing an unprotected key. On macOS, the Keychain can retain the passphrase; Linux workstations generally use ssh-agent with a desktop keyring or service-specific agent.
Environment inheritance is a common hidden cause. SSH_AUTH_SOCK may be missing inside tmux, a systemd service, an IDE terminal, or a screen-sharing session. Run printf '%s\n' "$SSH_AUTH_SOCK" in the same shell that starts Capistrano. If it is empty there but present elsewhere, carry the correct agent socket into that session rather than copying private keys between machines.
Check ownership and permissions as well. The home directory should not be group-writable, ~/.ssh should normally be 700, a private key 600, and a public key 644. Run chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_ed25519 && chmod 644 ~/.ssh/id_ed25519.pub to repair common Unix permissions. If the server still reports an unprotected private-key file, check inherited ACLs and SELinux labels, not only the numeric mode.
Separate target access from repository access
A deployment commonly crosses two SSH boundaries. The first authenticates the workstation or CI runner to the deploy host; the second authenticates the deploy user to Git, a self-hosted forge, or another source service. A public key in /home/deploy/.ssh/authorized_keys grants the first permission, but it does not grant the second.
Compare failures by the hop where they occur:
| Failure point | Typical signal | Diagnostic check | Targeted correction |
|---|---|---|---|
| Workstation to target | Permission denied (publickey) |
ssh -vvv -T to the deploy host |
Add the correct public key to the deploy user's authorized_keys |
| Target to repository | Git reports Permission denied |
Run git ls-remote as the deploy user |
Authorise a repository deploy key or grant account access |
| Local key discovery | Identity file ... not accessible |
ssh -G host and inspect the path |
Correct the path, ownership, or SSH configuration |
| Local agent access | Could not open ... authentication agent |
Run ssh-add -l and inspect SSH_AUTH_SOCK |
Start the agent and load the required key |
| Server identity trust | Host key verification failed |
Verify the fingerprint with the provider | Update known_hosts only after verification |
These cases require different owners and fixes. A local path error needs no server change, while a rejected repository key must be fixed for the deploy account rather than your personal administrator account.
To reproduce the second hop, log in to the target as the deploy user and run the repository's read-only command, such as git ls-remote git@github.com:organisation/project.git. If it works only after switching users, align Capistrano's deploy user with the account authorised for the repository.
Match Capistrano settings to the effective SSH config
Capistrano versions and SCM plugins expose slightly different setting names, but the useful distinction is stable: the deploy user, server hostname, repository URL, and SSH options must describe the same identity chain. In many Capistrano 3 projects, set :ssh_options, { keys: ["~/.ssh/id_ed25519"], forward_agent: false, auth_methods: ["publickey"] } forces a predictable key. Adjust the filename and user to your environment.
Do not assume ~/.ssh/config will rescue a mismatch. SSH applies Host blocks by alias, and Capistrano may connect to a literal IP address or another hostname. The same trap applies to repository URLs: an scp-style Git URL such as git@forge.example.au:team/app.git invokes the remote user's SSH configuration, which may select another key. Compare the effective output from ssh -G for both hosts.
Set forward_agent to false unless remote Git genuinely needs the local agent. Agent forwarding expands the trust boundary to the destination account and can expose agent identities to a compromised process. Keep SSH options in config/deploy.rb under source control, but never commit a private key or passphrase.
Apply Australian operational and security context
Australian hosting choices make a documented identity path particularly valuable. Instances in the AWS Sydney and Melbourne regions, plus services offered by local managed-hosting providers, can sit behind different bastion, VPN, and support arrangements. A laptop carried between a home desk, a Melbourne co-working space, and a client office may use a different agent each day. Record the expected key fingerprint as well as its filename.
Distributed teams in Brisbane, Sydney, Melbourne, Adelaide, and Perth also hand deployments across shifts. The next engineer should be able to distinguish a missing local key, a changed server account, or a repository permission revoked during onboarding. A short runbook with the failing command, expected identity, and recovery owner prevents a 5 p.m. release in Sydney from becoming a 2 a.m. troubleshooting session in Perth.
Credential handling can also carry Australian legal and governance implications. Where compromised access could expose personal information, the Privacy Act 1988 and Notifiable Data Breaches scheme make containment and evidence collection part of incident response. The Australian Signals Directorate's Essential Eight is not legislation, but many organisations use it to shape access-control and audit expectations. Keep private keys off shared laptops, rotate them after staff changes, and never place them in logs or support tickets. The Coding Journal applies the same clarity to European blackjack strategy, where each decision branch is made explicit.
Verify the recovery and standardise the fix
After correcting the key or configuration, repeat the isolated SSH probe and repository read test before running Capistrano again.
- Document the deploy host, repository, expected SSH fingerprint, and deploy user in the deployment runbook.
- Load the correct key into the agent before each environment-specific release window.
- Test repository access as the deploy account, not as a personal administrator.
- Require a named owner and escalation path for hosted servers with local business-hour support.
- Add a staging connection check to CI while keeping private keys in the CI secret store.
The final cap production deploy should be treated as verification, not as the first place to test credentials. If it succeeds, capture the effective key fingerprint and configuration in the change record, then confirm that another engineer can follow the runbook. If it fails, compare the new verbose output against the hop-by-hop checks rather than broadening StrictHostKeyChecking or disabling authentication.
Create the runbook entry now, rehearse the SSH and repository checks in a non-production environment, and use that verified sequence for the next release.
cat ~/interests.json
| Key | Value |
|---|---|
| editor | Terminal-first workflow |
| os | Mac OS X / Unix |
| vcs | Git, distributed version control |
| deploy | Capistrano, cron automation |
| graphics | SVG, Adobe Illustrator troubleshooting |
| networking | IP validation, SSH, VPN |
git log --oneline --reverse
Solving SVG import issues in Adobe Illustrator CS6 and CC
When importing an SVG into Illustrator, the operation fails with an unknown error [CANT]. A workaround for this Adobe-side bug.
Solving NDK build issues on OS X
Troubleshooting native development kit compilation problems on Mac OS X.
Programmatically adding PHP generated TypoScript to the backend configuration
Integrating dynamically generated TypoScript into Typo3 backend setups using PHP.
ArgumentError: Could not parse PKey: no start line
Debugging an SSH key parsing error encountered during deployment.
Validating IP-Addresses in PHP
Using PHP filter functions with flags like FILTER_FLAG_IPV4 and FILTER_FLAG_IPV6, and understanding how filter_var handles reserved IP addresses.
Cocoa: Using NSTrackingArea
A short tutorial on using Cocoa's NSTrackingArea to capture mouseEntered and mouseExited events.
cat ~/contact.txt