Skip to content

Linux & shell: Access & secrets

Linux & shell commands for access & secrets (tags: #access #secrets #ssh).

Index
2 items

Linux: SSH into a host with a specific key

Safe

Connect using one explicit key (avoids 'Too many authentication failures').

ssh -i <key-file> -o IdentitiesOnly=yes <user>@<host>
What each part does
  1. sshSSH client
  2. -i <key-file>use this private key
  3. -o IdentitiesOnly=yesoffer only that key, not every key in the agent (avoids Too many authentication failures)
  4. <user>@<host>who and where

Also known as: ssh · Too many authentication failures · permission denied (publickey)

Linux: Open an SSH tunnel through a bastion

Safe

Forward a local port to a private host/port via a jump box. Then connect to localhost:<local-port>.

ssh -N -L <local-port>:<target-host>:<target-port> <user>@<bastion>
What each part does
  1. sshSSH client
  2. -Ndon't run a remote command: tunnel only
  3. -L <local-port>:<target-host>:<target-port>localhost:local-port forwards to target-host:target-port as seen from the bastion
  4. <user>@<bastion>the jump host to connect to
Example
$ ssh -N -L 5432:db.internal:5432 ops@bastion.example.com

Also known as: port forward · bastion · jump host · ssh tunnel

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…