Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 35 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# 🖥️ panssh – Pantheon Interactive SSH Session Emulator
# 🖥️ PanSSH
## An emulated SSH login for Pantheon sites

`panssh` emulates an interactive SSH connection to a Pantheon site's application environment using only their available (limited) SSH service. It provides command history, local editing of remote files and an emulated current working directory.
PanSSH emulates an interactive SSH connection to a Pantheon site's application environment using only their available (limited) SSH service. It provides command history, local editing of remote files and an emulated current working directory.

You can do almost everything that you could if a standard SSH login were available, and it looks and feels near identical.
You can do almost everything that you could if a standard SSH login were available, and it looks and feels so familiar that you may not notice the difference.

### Quick start

##### Download and run the main script

```
curl -so panssh https://raw.githubusercontent.com/LastCallMedia/panssh/refs/heads/lando/panssh
chmod +x panssh
./panssh
```
Further instructions will then be displayed.

### Recent changes
* Tab-completion is now included, on supporting systems:
* 1.2.1: Added [.lando.panssh.yml](https://github.com/LastCallMedia/panssh/blob/lando/lando/.lando.panssh.yml), which provides [easy setup](https://github.com/LastCallMedia/panssh/blob/lando/lando/README.md) of PanSSH in a [Lando](https://lando.dev/) project.
* 1.2.0: Tab-completion is now included, on supporting systems:
* Local site and environment names.
* Remote directory and file names.

Expand All @@ -19,11 +32,13 @@ panssh site.env
```

### Non-Interactive

##### From command-line:
```
# From command-line:
panssh site.env "command1; command2; ..."

# From stdin:
```
##### From stdin:
```
panssh site.env < script.sh
echo "commands" | panssh site.env
```
Expand Down Expand Up @@ -64,27 +79,36 @@ echo "commands" | panssh site.env

### No installation

* Mark the main `panssh` script as executable: `chmod +x panssh`
* Run it as just `./panssh` to see further information.
The only required file is the `panssh` script.

##### Download just the main script

```
curl -so panssh https://raw.githubusercontent.com/LastCallMedia/panssh/refs/heads/lando/panssh
```
* Mark the script as executable: `chmod +x panssh`
* Run it as just `./panssh` to see further instructions.

### Minimal installation

Clone the [PanSSH repository](https://github.com/LastCallMedia/panssh) or download and unzip the [zip archive](https://github.com/LastCallMedia/panssh/archive/refs/heads/lando.zip).

Mark the main `panssh` script as executable, then copy or move it to any suitable directory that's included in your PATH.

```
chmod +x panssh
sudo mv panssh /usr/local/bin/
```

Run it as just `panssh` to see further information.
Run it as just `panssh` to see further instructions.

### Optional: tab-completion of local site and environment names

Copy the `panssh` completion script from `bash-completion/` to the `bash-completions/completions` directory on your system.
* For recent Ubuntu distributions, you can probably use `/usr/local/share/bash-completion/completions/`
* For MacOS, maybe `/opt/homebrew/etc/bash_completion.d/` or `usr/local/etc/bash_completion.d`, depending on your system.

Test tab-completion by entering `panssh ` then pressing the tab key.
Test tab-completion by entering `panssh ` then pressing the tab key (create a sites configuration file first).

### Optional: tab-completion of remote directory and file names

Expand Down
43 changes: 43 additions & 0 deletions lando/.lando.panssh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This file is an optional part of the PanSSH utility.
# It provides service and tooling setup to facilitate use of PanSSH under Lando.

# See: https://github.com/LastCallMedia/panssh
# and: https://github.com/LastCallMedia/panssh/lando/README.md

# Commands provided:
#
# lando panssh <site.env> : starts PanSSH for the specified site and environment.
# lando pssh : starts PanSSH for the related site and environment matching your current git branch.

services:
appserver:
build_as_root:
- echo "PanSSH installation..."
# PanSSH main script.
- curl -so /usr/local/bin/panssh https://raw.githubusercontent.com/LastCallMedia/panssh/refs/heads/lando/panssh
- chmod +x /usr/local/bin/panssh
# PanSSH readx utility script.
- mkdir -p /usr/local/lib/panssh/
- curl -so /usr/local/lib/panssh/readx.source.sh https://raw.githubusercontent.com/LastCallMedia/panssh/refs/heads/lando/readx.source.sh
# Bash tab-completion support and basic editor.
- apt-get -qqq update && apt-get -qqq install bash-completion nano
# Bash-completion support for the panssh command (and other commands available via `lando ssh`).
# For this to work, we would have to either uncomment /etc/bash.bashrc "enable bash completion" section,
# or include the equivalent in ~/.bashrc or some other suitable location.
# - mkdir -p /usr/local/share/bash-completion/completions
# - curl -so /usr/share/bash-completion/completions/panssh https://raw.githubusercontent.com/LastCallMedia/panssh/refs/heads/lando/bash-completion/panssh
- echo "PanSSH installation complete."
build:
# Run terminus (if available) to create the .panssh.sites file.
- hash terminus && terminus auth:login && terminus site:list --format=csv --fields=name,id > $HOME/.panssh.sites

tooling:
panssh:
service: appserver
description: "Opens an emulated interactive SSH connection to a Pantheon site/environment."
usage: $0 panssh <site>.<env>
cmd: panssh
pssh:
service: appserver
description: "Opens an emulated interactive SSH connection to the related site and environment matching your git branch."
cmd: br="$(git branch --show-current)"; test "$br" = "master" && br="dev"; panssh "$PANTHEON_SITE_NAME.$br"
34 changes: 34 additions & 0 deletions lando/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 🖥️ PanSSH under Lando

This file is an optional part of the [PanSSH](https://github.com/LastCallMedia/panssh) utility. It provides service and tooling setup to facilitate use of PanSSH under [Lando](https://lando.dev/).

## ✅ Requirements

- A Lando application built using the [Lando Pantheon Plugin](https://docs.lando.dev/plugins/pantheon/index.html) or other configuration which meets [PanSSH requirements](https://github.com/LastCallMedia/panssh/blob/main/README.md#-requirements).

## 📦 Installation

1. Either clone the [PanSSH repository](https://github.com/LastCallMedia/panssh) or download `.lando.panssh.yml` directly:

```
curl -so .lando.panssh.yml https://raw.githubusercontent.com/LastCallMedia/panssh/refs/heads/lando/lando/.lando.panssh.yml
```
2. Place `.lando.panssh.yml` in the same location as your application's `.lando.yml` file.

2. Do one of:
1. Rename it to `.lando.local.yml`, or merge it into your existing `.lando.local.yml` file, if present.
2. Add `.lando.panssh.yml` into the `postLandoFiles` section of your `~/.lando/config.yml` (recommended).

⚙️ In either case, see: https://docs.lando.dev/landofile/#configuration for further information. You may need to create `~/.lando/config.yml` if it is currently missing or empty.

3. Run `lando rebuild` to apply the changes. This will download and install the relevant components into your Lando application:
* PanSSH scripts.
* Supporting OS packages.
* PanSSH sites configuration file (runs Terminus).

## Commands provided:

* `lando panssh <site.env>` — starts PanSSH for the specified site and environment.
* `lando pssh` — starts PanSSH for the related site and environment name matching your current git branch.

---
Loading