Metadata-Version: 2.4
Name: sshm-terminal
Version: 1.0.0
Summary: Terminal SSH connection manager with macOS Keychain integration and Matrix-themed TUI
Project-URL: Homepage, https://github.com/dailydeploy365/sshm
Project-URL: Repository, https://github.com/dailydeploy365/sshm
Project-URL: Issues, https://github.com/dailydeploy365/sshm/issues
Author: Rajesh
License-Expression: MIT
License-File: LICENSE
Keywords: connection-manager,keychain,macos,ssh,terminal,tui
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: System :: Networking
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Terminals
Requires-Python: >=3.10
Requires-Dist: textual>=0.80.0
Description-Content-Type: text/markdown

# SSHM - SSH Connection Manager

A terminal-based SSH connection manager for macOS with a Matrix-themed TUI. Store server credentials securely (passwords in macOS Keychain), and connect with a single keypress.

![Python](https://img.shields.io/badge/python-3.10+-00ff41?style=flat-square&logo=python&logoColor=00ff41&labelColor=0d0208)
![macOS](https://img.shields.io/badge/macOS-supported-00ff41?style=flat-square&logo=apple&logoColor=00ff41&labelColor=0d0208)
![License](https://img.shields.io/badge/license-MIT-00ff41?style=flat-square&labelColor=0d0208)

## Features

- **Interactive TUI** - Navigate servers with arrow keys, connect with Enter
- **Secure password storage** - Passwords saved in macOS Keychain (never plaintext)
- **Auto sudo** - Optionally elevate to root automatically after SSH login
- **Search/filter** - Quickly find servers by name, host, user, or group
- **Copy SSH command** - Copy the raw `ssh` command to clipboard
- **Matrix theme** - Green-on-black hacker aesthetic

## Install

### Option A: pipx (recommended)

One command, no manual venv or alias needed:

```bash
pipx install sshm-terminal
```

> Don't have pipx? Install it first: `brew install pipx && pipx ensurepath`

### Option B: Homebrew

```bash
brew tap dailydeploy365/tap https://github.com/dailydeploy365/homebrew-tap
brew install sshm
```

### Option C: From source (for development)

```bash
git clone https://github.com/dailydeploy365/sshm.git
cd sshm
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
```

Then add an alias so `sshm` works from anywhere:

```bash
# Add to ~/.zshrc
alias sshm="/path/to/sshm/.venv/bin/sshm"
source ~/.zshrc
```

### Optional: install sshpass for cleaner password auth

```bash
brew install esolitos/ipa/sshpass
```

Without it, the app falls back to macOS built-in `expect` which works fine.

## Requirements

- macOS (uses `security` CLI for Keychain and `expect` for password automation)
- Python 3.10+

## Usage

### Launch the TUI

```bash
sshm
```

### Quick list from the terminal

```bash
sshm list
```

### TUI Keybindings

| Key       | Action                          |
|-----------|---------------------------------|
| `a`       | Add a new server                |
| `e`       | Edit selected server            |
| `d`       | Delete selected server          |
| `Enter`   | SSH into selected server        |
| `c`       | Copy SSH command to clipboard   |
| `/`       | Search / filter servers         |
| `Esc`     | Close search, or quit           |
| `q`       | Quit                            |

### Add/Edit Form

| Key       | Action           |
|-----------|------------------|
| `ctrl+s`  | Save             |
| `Esc`     | Cancel           |
| `Tab`     | Next field       |

### Delete Confirmation

| Key           | Action    |
|---------------|-----------|
| `y` / `Enter` | Confirm  |
| `n` / `Esc`   | Cancel   |

## How-To: Add and connect to a server

**Step 1** - Run `sshm`

**Step 2** - Press `a` to open the Add Server form

**Step 3** - Fill in the fields:

```
Name:       Production API
Host / IP:  192.168.1.50
Port:       2222
User:       deploy
Group:      production
Password:   ••••••••
SSH Key:    (leave empty if using password)
```

Check **"Auto sudo"** if you want to automatically get a root shell after login.

**Step 4** - Press `ctrl+s` to save

**Step 5** - Select the server in the list and press `Enter` to connect

That's it. Next time, just `sshm` → arrow to your server → `Enter`.

## How-To: Use SSH key instead of password

**Step 1** - When adding/editing a server, leave the Password field empty

**Step 2** - Fill in the SSH Key Path field:

```
SSH Key Path:  ~/.ssh/id_rsa
```

**Step 3** - Save with `ctrl+s`

The app will use `ssh -i ~/.ssh/id_rsa` when connecting.

## How-To: Copy the SSH command

Select a server and press `c`. The raw SSH command gets copied to your clipboard:

```
ssh -p 2222 deploy@192.168.1.50
```

Useful for scripts, sharing with teammates, or pasting into another terminal.

## How it works

| What              | Where                                      |
|-------------------|--------------------------------------------|
| Server metadata   | `~/.sshm/servers.json`                     |
| Passwords         | macOS Keychain (via `security` CLI)         |
| SSH connection    | `sshpass` if installed, else `expect`       |
| Auto sudo         | `expect` script (SSH login + `sudo -i`)    |

## CLI Commands

```
sshm          Open the TUI manager
sshm list     List saved servers in the terminal
sshm help     Show usage info
```

## Uninstall

```bash
# Remove the alias from ~/.zshrc
# Then:
rm -rf ~/.sshm            # Remove server data
pip uninstall sshm         # Remove the package
```

Passwords stored in macOS Keychain can be removed via Keychain Access.app (search for "sshm").
