liveBook · Manning

Passwordless SSH session

As explained in Road to Kubernetes

A passwordless SSH session is an SSH connection authenticated through keys or another non-password mechanism.

A passwordless SSH session connects to a remote machine with a private key instead of an interactive password. The private key stays protected locally or in GitHub Actions secrets; the matching public key belongs in the remote user's authorized_keys file. section 4.1.5

Prepare the connection before an automated workflow uses it:

  • Make the private key available and restrict it with chmod 600. section 4.1.5
  • Install the public key remotely in ~/.ssh/authorized_keys. section 4.1.5
  • Provide an accessible IP address or hostname. section 4.1.5
  • Inject the private key into the workflow, configure host-key handling, and run SSH commands against the remote host. section 4.1.5

Installing NGINX from GitHub Actions

A workflow writes the SSH_PRIVATE_KEY secret to ~/.ssh/id_rsa, applies chmod 600, sets StrictHostKeyChecking=no, then uses the instance address to run apt update and apt install nginx -y remotely.

How Road to Kubernetes covers it

How deep it goes
Defines key, permission, public-key, address, secret-injection, and host-checking requirements, then demonstrates the workflow.
Examples
Uses a GitHub Actions workflow to install NGINX on a remote Akamai instance with SSH commands.
What it assumes
Assumes an SSH key pair, a remote machine, and an accessible address; teaches how to expose the private key safely to the workflow.
What you can do after
Operate/configure GitHub Actions to establish SSH access and install NGINX on a remote machine.
How it connects
Connects SSH with public-key authentication, GitHub Actions secrets, remote servers, and NGINX installation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.