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
88 changes: 88 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Makefile for the s tool

# Variables
VERSION := 1.0.0
PREFIX := /usr/local
BINDIR := $(PREFIX)/bin
LIBDIR := $(PREFIX)/lib/s
CONFIGDIR := $(HOME)/.s
CONFIGFILE := $(HOME)/.sconfig

# Colors for output
RED := \033[0;31m
GREEN := \033[0;32m
YELLOW := \033[1;33m
BLUE := \033[0;34m
NC := \033[0m # No Color

# Default target
all: install

# Install the tool
install: check-deps
@echo -e "${BLUE}Installing s tool...${NC}"
@mkdir -p $(BINDIR) $(LIBDIR)
@cp -f bin/s $(BINDIR)/
@chmod 755 $(BINDIR)/s
@cp -f lib/*.sh $(LIBDIR)/
@chmod 644 $(LIBDIR)/*.sh
@echo -e "${GREEN}Installation complete${NC}"

# Install for current user only
install-home: check-deps
@echo -e "${BLUE}Installing s tool for current user...${NC}"
@mkdir -p $(HOME)/bin $(HOME)/.s/lib
@cp -f bin/s $(HOME)/bin/
@chmod 755 $(HOME)/bin/s
@cp -f lib/*.sh $(HOME)/.s/lib/
@chmod 644 $(HOME)/.s/lib/*.sh
@echo -e "${GREEN}Installation complete${NC}"
@echo -e "${YELLOW}Make sure $(HOME)/bin is in your PATH${NC}"

# Uninstall the tool
uninstall:
@echo -e "${BLUE}Uninstalling s tool...${NC}"
@rm -f $(BINDIR)/s
@rm -rf $(LIBDIR)
@echo -e "${GREEN}Uninstallation complete${NC}"

# Run tests
test: check-deps
@echo -e "${BLUE}Running tests...${NC}"
@./tests/run-tests.sh
@echo -e "${GREEN}Tests complete${NC}"

# Check dependencies
check-deps:
@echo -e "${BLUE}Checking dependencies...${NC}"
@command -v bash >/dev/null 2>&1 || { echo -e "${RED}Error: bash is required${NC}"; exit 1; }
@command -v ssh >/dev/null 2>&1 || { echo -e "${RED}Error: ssh is required${NC}"; exit 1; }
@command -v ssh-keygen >/dev/null 2>&1 || { echo -e "${RED}Error: ssh-keygen is required${NC}"; exit 1; }
@echo -e "${GREEN}All dependencies satisfied${NC}"

# Run shellcheck
lint:
@echo -e "${BLUE}Running shellcheck...${NC}"
@command -v shellcheck >/dev/null 2>&1 || { echo -e "${RED}Error: shellcheck is required${NC}"; exit 1; }
@shellcheck bin/s lib/*.sh tests/*.sh
@echo -e "${GREEN}Linting complete${NC}"

# Clean build artifacts
clean:
@echo -e "${BLUE}Cleaning...${NC}"
@rm -rf build/
@find . -type f -name "*.log" -delete
@echo -e "${GREEN}Clean complete${NC}"

# Show help
help:
@echo -e "${BLUE}Available targets:${NC}"
@echo -e " ${GREEN}install${NC} - Install system-wide (requires root)"
@echo -e " ${GREEN}install-home${NC} - Install for current user only"
@echo -e " ${GREEN}uninstall${NC} - Remove the tool"
@echo -e " ${GREEN}test${NC} - Run tests"
@echo -e " ${GREEN}lint${NC} - Run shellcheck"
@echo -e " ${GREEN}clean${NC} - Clean build artifacts"
@echo -e " ${GREEN}help${NC} - Show this help message"

.PHONY: all install install-home uninstall test check-deps lint clean help
114 changes: 63 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,88 @@
s
=
# SSH Connection Manager (s)

s is the dead-simple command line ssh configuration management tool you've always wanted. Built to do one thing well—remember ssh connections and recall them as simple, single word configuration aliases. Written in bash and licensed as freeBSD so you can use it nearly everywhere.
A powerful and user-friendly SSH connection manager that simplifies server access and key management.

Installing s:
## Features

One-line auto-install latest version from github:
- Easy server connection management
- SSH key generation and management
- Template-based configuration
- Port forwarding support
- Connection retry mechanism
- ANSI color-coded output
- Comprehensive error handling

wget -O- https://raw.github.com/grobertson/s/master/bin/s -O /tmp/s && cd /tmp && chmod 700 /tmp/s && ./s --install system && rm -f /tmp/s
## Installation

cd /tmp && wget -O- https://github.com/grobertson/s/archive/master.tar.gz | tar xz && cd s-master && make install && cd -

From this directory:
```bash
# Clone the repository
git clone https://github.com/groberts/s.git
cd s

To install s for just the current user:
# Install
make install
```

./s --install home
## Configuration

To install s for everyone (requires root, or at least write permissions on /usr/local/bin):
The tool uses a configuration file located at `~/.sconfig`. A default configuration will be created on first run:

./s --install system
```bash
# s configuration
KEYPATH=~/.ssh
KEYFILE=id_rsa
```

Removing s:
## Usage

./s --remove force
```bash
# Connect to a server
s server-name

Usage:
# Generate a new SSH key
s keygen

usage: s [configuration_name|--save configuration_name][-i identity_file] user@host.com
s show — Show available configurations
s list — Show available configurations
s <configuration_name> — Load configuration and ssh to remote acct/system
s help — Display this message
# List available servers
s list

CHANGELOG:
# Add a new server
s add server-name

5/20/2012

*Option to create/install/save a new 2048 bit keypair on a remote host
*'s --addkey [-i existing_keyfile] user@host.com NewConfigName' (no -i will prompt for password)
*Self install './s --install (home|system)'
*system option to --install uses least privledged bin ("/usr/local/bin/", "/usr/bin/", "/bin/" in order)
*Self uninstall './s --remove force' Removes from all likely places (home, local, user, /bin)
*Added INSTALL file
*Added install directions to README

5/19/2012
# Remove a server
s remove server-name

*freeBSD license added
*create a new configuration by connecting once and passing a name to --save option
*Humanized error when configuration name doesn't exist
*ssh option -i recognition/handling
*config moved to ~/.s and ~/.sconfig, autocreates
# Show help
s help
```

5/17/2012
## Development

*"show" and "list" are now interchangeable
*Hide the "template" configuration from the show/list function
### Prerequisites

- Bash 4.0 or higher
- SSH client
- Make

4/22/2012
### Running Tests

*show, help and connect functions
*include a template for basic configurations
```bash
make test
```

TO-DO:
### Code Style

*clone config from remote with s installed
*more complete coverage of ssh options (port forwarding first!)
*list/delete/replace keys in ~/.ssh/
*list/delete/replace keys on the remote
*Needs a "delete" command
This project follows the [Google Shell Style Guide](https://google.github.io/styleguide/shellguide.html).

## License

BSD License - See LICENSE file for details

## Contributing

1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a new Pull Request



Loading