Software Engineer's Blog

From SecureCRT to Ghostty: Building a Better SSH Workflow

From SecureCRT to Ghostty: Building a Better SSH Workflow

For a long time, I relied on SecureCRT for managing SSH sessions. It’s a solid tool with features like session management and built-in logging. However, recently I started using AI tools like Claude more actively, and I ran into an unexpected issue.

SecureCRT’s scrolling behavior and text handling didn’t work well for this kind of workflow. When reviewing long outputs or copying logs into Claude, the experience felt clunky. It became difficult to smoothly navigate and reuse terminal output.

That pushed me to rethink my setup. Over the past couple of days, I migrated my SSH workflow to Ghostty and rebuilt everything using standard Linux tools. The result turned out to be simpler, faster, and more flexible than I expected.

1. Managing SSH Sessions with ~/.ssh/config

Instead of using a GUI-based session manager, I defined all SSH sessions in a config file. This file acts as my central database for all connections.

~/.ssh/config

Example:

Host dev-app
    HostName 192.168.1.144
    User appuser

Host dev-db
    HostName 192.168.1.144
    User dbuser

Host dev-cache
    HostName 192.168.1.144
    User cacheuser

Host dev-worker
    HostName 192.168.1.144
    User workeruser

Now I can connect using simple commands:

ssh dev-app
ssh dev-db

No need to remember IP addresses or usernames.

2. Eliminating Passwords with SSH Key Authentication

Typing passwords repeatedly is a productivity killer. I generated an SSH key and distributed it to my servers for instant access.

So I generated an SSH key:

ssh-keygen -t ed25519

Then copied it to each account:

ssh-copy-id dev-app
ssh-copy-id dev-db
ssh-copy-id dev-cache
ssh-copy-id dev-worker

Now I can connect instantly without entering a password.

3. Logging SSH Sessions (Replacing SecureCRT Logging)

SecureCRT provides built-in logging, but Ghostty follows the UNIX philosophy of doing one thing well. To replace logging, I use the standard Linux script command.

I added this function to my .bashrc:

ssh-log() {
    local host="$1"

    if [ -z "$host" ]; then
        echo "Usage: ssh-log <host>"
        return 1
    fi

    local dir="$HOME/logs/$host"
    local logfile="$dir/$(date +%F_%H-%M-%S).log"

    mkdir -p "$dir"
    script -q -f "$logfile" -c "ssh $host"
}

Note: Since script records everything including ANSI color codes, you might want to use cat or a specific cleaner when copying logs to AI tools.

4. Displaying a Clean SSH Session List

One feature I missed from SecureCRT was the session list UI. I wrote a small function to parse my config and display a clean table.

# Function to display a list of SSH hosts
ssh-list() {
    {
        # Header (space-separated for column alignment)
        echo "HOST HOSTNAME USER"
        echo "---- -------- ----"
        
        # Parse the ~/.ssh/config file
        # Iterate through lines to collect Host, HostName, and User info, then print as a single line
        awk '
            tolower($1) == "host" { host=$2 }
            tolower($1) == "hostname" { ip=$2 }
            tolower($1) == "user" { print host, ip, $2 }
        ' ~/.ssh/config
    } | column -t
}

Output:

$ ssh-list
HOST       HOSTNAME       USER
---------- -------------  ---------
dev-app    192.168.1.144  dev-app
dev-db     192.168.1.144  dev-db
dev-cache  192.168.1.144  dev-cache
dev-worker 192.168.1.144  dev-worker

Final Workflow

This is my daily routine now:

  • ssh-list: Browse available sessions.
  • ssh dev-app: Quick access for routine tasks.
  • ssh-log dev-app: Used when I need to keep a record for Claude or documentation.

Final Thoughts

Switching from SecureCRT to Ghostty wasn’t just about changing tools. It forced me to understand SSH more deeply and rely on standard Linux tools. In the end, I have a workflow that is simpler, more flexible, and more powerful.