Skip to main content

SSH

🎯 Purpose

Allow the Watchman agent to securely access machines via SSH to collect the necessary data for analysis.


🐧 For Linux

1. Install and start the SSH server

sudo apt-get update
sudo apt-get install openssh-server
sudo systemctl start ssh
sudo systemctl enable ssh # (optional, to start on boot)

Open the port in the firewall

sudo ufw allow 22/tcp

✅ Check:

  • Verify the SSH service is running:

    sudo systemctl status ssh

For Windows

1. Enable OpenSSH Server

  • Open Settings > Apps > Optional Features
  • Click Add a feature
  • Search for OpenSSH Server, click Install
  • Once installed, start the service:
Start-Service sshd
  • For automatic startup:
Set-Service -Name sshd -StartupType 'Automatic'

2. Configure the firewall

  • Open Windows Defender Firewall with Advanced Security
  • Create an inbound rule for TCP 22 (see previous section for details)

3. Key-based authentication (optional)

  • Generate an SSH key pair:
ssh-keygen
  • Copy the public key to:

    C:\Users\<Username>\.ssh\authorized_keys
  • Ensure correct permissions on the .ssh folder and the authorized_keys file


🛡️ Best practices:

  • Change the SSH port (e.g., to 2222) for increased security
  • Disable password authentication if using keys
  • Monitor SSH connections with fail2ban or similar tools (Linux)