LinuxCommandLibrary

gotty

Share terminal via web browser

TLDR

Share result of command

$ gotty [command]
copy

Share with write permission
$ gotty [[-w|--permit-write]] [shell]
copy

Share with credential (Basic Auth)
$ gotty [[-w|--permit-write]] [[-c|--credential]] [username]:[password] [shell]
copy

SYNOPSIS

gotty [options] [command arguments...]

PARAMETERS

--port
    Specifies the port number for the web server to listen on.
Default: 8080

--host


    Defines the host address to bind the web server to.
Default: 0.0.0.0

--permit-write
    Allows clients to send input to the TTY, enabling interactive sessions.
Default: Read-only

--credential
    Enables basic authentication for access to the web terminal with specified username and password.

--once
    Instructs gotty to exit automatically when the last client disconnects.

--ssl
    Enables SSL/TLS encryption for secure communication. Requires --ssl-crt and --ssl-key.

--ssl-crt
    Path to the SSL/TLS certificate file (.crt or .pem).

--ssl-key
    Path to the SSL/TLS private key file (.key or .pem).

--index
    Specifies an HTML file to serve as the custom index page for the web interface.

--config
    Path to a YAML configuration file to load options from.

--max-clients
    Sets the maximum number of concurrent client connections allowed.

DESCRIPTION

Gotty is a simple command-line tool that turns your terminal, or a specific program, into a web application. Written in Go, it launches a web server that streams terminal output to a web browser using WebSockets. This allows users to access a live terminal session remotely without traditional SSH. It's particularly useful for demonstrations, online tutorials, or providing web-based access to specific command-line tools. Gotty supports various features like SSL/TLS encryption, basic authentication, configurable host/port, and the ability to permit client input. Its single-binary distribution makes it easy to deploy across different platforms.

CAVEATS

Security Risk: Exposing a full shell with --permit-write to the public internet can be a significant security risk. Consider running specific, sandboxed commands instead of a full shell.
Resource Usage: Each connected client consumes server resources. High concurrent usage might impact performance.
Browser Compatibility: Relies on modern web browser features, specifically WebSockets, for real-time communication.

DEFAULT COMMAND EXECUTION

If no specific command is provided as an argument, gotty defaults to executing the user's login shell (e.g., /bin/bash or /bin/zsh). This means a full interactive terminal session is exposed by default.

WEBSOCKET COMMUNICATION

Gotty heavily relies on WebSockets for real-time, bidirectional communication between the server and the client's web browser. This technology enables a fluid and responsive terminal experience directly within the browser.

STATIC FILE SERVING

Beyond the terminal itself, gotty can serve static files from a specified directory. This feature allows for custom styling, branding, or the inclusion of additional web content alongside the terminal interface.

HISTORY

Gotty was created by Shota Fukumori (sugyan) and is written in the Go programming language. Its development aimed to provide a lightweight, cross-platform, and easy-to-deploy solution for sharing terminal sessions over the web, leveraging Go's strong networking capabilities and single-binary compilation. It emerged as a simpler alternative to more complex setups involving terminal multiplexers and WebSocket proxies.

SEE ALSO

tmux(1), screen(1), ssh(1), ttyd(1)

Copied to clipboard