Zo ssh setup

From zocomputer/skills · View interactive version

Zo ssh setup is an AI agent skill from the GitHub repository zocomputer/skills. Sets up secure remote access to your Zo Computer so you can connect from anywhere

How to use this skill

Skill file

Set Up SSH Server (sshd) Service on Zo Computer

How to Use This File

This file will be included in a user request. If it is, and the user has provided the necessary inputs, Zo should interpret this as the current task at hand and use its tools to carry out the task until completion. Zo should not ask for user confirmation to continue if it has all required parameters to execute this function. Zo should effectively treat the inclusion of this file as a user request to "run" this task.

Purpose

This document codifies the procedure for setting up an SSH server (sshd) as a managed user service on Zo Computer, allowing secure remote shell access to the machine. The setup includes configuring authentication (either SSH keys or password), installing necessary packages, configuring sshd, and registering the service to run persistently with automatic restarts.

Inputs

Procedure

  1. Configure authentication based on the chosen method:

If using public key authentication:

```bash

echo "<public_key_content>" >> /root/.ssh/authorized_keys

chmod 600 /root/.ssh/authorized_keys

```

Replace <public_key_content> with the actual SSH public key provided by the user.

If using password authentication:

```bash

echo "root:<password>" | chpasswd

```

Replace <password> with the password provided by the user.

  1. Create or update sshd configuration file at /etc/ssh/sshd_config with the following settings:

```bash

cat > /etc/ssh/sshd_config << 'EOF'

# Port will be set via command-line flag (-p)

Protocol 2

# Authentication

PermitRootLogin yes

PubkeyAuthentication yes

AuthorizedKeysFile .ssh/authorized_keys

PasswordAuthentication <password_auth_setting>

PermitEmptyPasswords no

ChallengeResponseAuthentication no

# Security

X11Forwarding no

PrintMotd no

AcceptEnv LANG LC_*

# Logging

SyslogFacility AUTH

LogLevel INFO

# Subsystems

Subsystem sftp /usr/lib/openssh/sftp-server

EOF

```

Replace <password_auth_setting> with yes if using password authentication, or no if using key-only authentication.

  1. Choose an available port for the SSH service (recommend using a port in the 20000-30000 range to avoid conflicts). DO NOT use port 22:

```bash

# Check if port is available (should return no output if free)

netstat -tuln | grep :<chosen_port>

```

If port 22222 is already in use, increment to 22223, 22224, etc. until you find a free port.

  1. Register the sshd service using the register_user_service tool:

```markdown

register_user_service(

label="sshd",

protocol="tcp",

local_port=<chosen_port>,

entrypoint="/usr/sbin/sshd -D -p <chosen_port>"

)

```

Replace <chosen_port> with the port number selected in step 3.

The service will:

  1. Verify the service is running:

```bash

# Check service logs for successful startup

cat /dev/shm/sshd.log

cat /dev/shm/sshd_err.log

# Verify sshd process is running

ps aux | grep sshd | grep -v grep

# Test local connectivity

nc -zv localhost <chosen_port>

```

  1. Retrieve the public TCP address from the service registration response (format: ts1.zocomputer.io:<port>).

Expected Output

Notification to the User

After each successful run of this procedure, communicate to the user:

Optional SSH Config Setup

Suggest to the user that they can create a convenient SSH shortcut on their personal computer by adding an entry to their ~/.ssh/config file:

Host myzo
  HostName <public_host>
  Port <public_port>
  User root
  ServerAliveInterval 30
  ServerAliveCountMax 3
  IdentityFile ~/.ssh/<users_key_file>

Replace the placeholders:

After adding this entry, they can simply connect with:

ssh myzo

The ServerAliveInterval and ServerAliveCountMax settings help keep the connection alive and detect dropped connections more reliably.

Next Steps and Use Cases

Now that SSH access is configured, inform the user they have several options for leveraging this connection:

Development Tools:

File Transfer:

Other Possibilities:

Ask the user: "What would you like to do with your SSH connection?" This helps guide them toward the next configuration steps based on their specific needs.

Service Management Notes

Technical Notes

Security Considerations


This document will be maintained and updated as SSH configuration needs evolve, but will always reflect the core action of establishing a secure, managed SSH server service on Zo Computer.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.