/

Configure Centralized SSH for Linux Using ShellHub

Managing multiple Linux devices via SSH can become cumbersome when dealing with scattered IP addresses and individual configurations. ShellHub simplifies this process by providing a centralized SSH gateway, allowing you to access all your devices through a single interface. Here’s how to set it up:

Why Use ShellHub?

  • Centralized Access: Connect to all devices via one entry point.
  • Enhanced Security: Utilizes SSH keys and TLS encryption for secure connections.
  • Easy Scalability: Automatically add new devices with minimal configuration.
image 1
ShellHub Dashboard

Step 1: Deploy the ShellHub Server

Install Docker

Ensure Docker is installed on your server (Ubuntu/Debian recommended):

sudo apt update && sudo apt install docker.io

Run the ShellHub Server

Deploy the ShellHub container. Replace YOUR_TENANT_ID with a unique identifier (e.g., your organization’s name):

sudo docker run -d --name shellhub \
  -p 80:80 -p 443:443 -p 22:22 \
  -e SHELLHUB_TENANT_ID="YOUR_TENANT_ID" \
  -v /var/run/docker.sock:/var/run/docker.sock \
  shellhubio/server:latest

Note: Ensure ports 80, 443, and 22 are open on your firewall.

Step 2: Enroll Devices

Install the ShellHub Agent

On each Linux device, run:

curl -sSf https://get.shellhub.io | sudo sh

Configure the Agent

When prompted, provide:

  • Server address: IP or domain of your ShellHub server.
  • Tenant ID: The same YOUR_TENANT_ID used in Step 1.

Once enrolled, devices will appear in the ShellHub dashboard.

Step 3: Connect via SSH

Access any device using the format:

ssh <device-name>.<tenant-id>@<shellhub-server-address>

Example:

ssh webserver1.mycompany@shellhub.example.com

Set Up SSH Keys:

Generate an SSH key pair:

ssh-keygen -t ed25519

Add the public key (~/.ssh/id_ed25519.pub) to the ShellHub dashboard under SSH Keys.

Troubleshooting

  • Device Not Visible: Check the agent logs with journalctl -u shellhub. Verify network/firewall settings.
  • Connection Issues: Confirm the tenant ID and server address are correct.

Conclusion

ShellHub streamlines SSH management for distributed Linux devices, reducing overhead and improving security. For advanced configurations, refer to the official ShellHub documentation.