Automate Server Package Updates Notification with n8n SSH and Email

Struggling to keep your server’s software packages updated regularly? This n8n workflow automates daily checks for upgradable packages on your VPS and sends you an email alert if updates are available, saving you manual effort and enhancing server security.
ssh
emailSend
code
+3
Learn how to Build this Workflow with AI:
Workflow Identifier: 1556
NODES in Use: Schedule Trigger, SSH, Code, If, Email Send, Sticky Note

Press CTRL+F5 if the workflow didn't load.

Visit through Desktop for Best experience

1. Opening Problem Statement

Meet Alex, a VPS admin managing multiple servers for his small business. Every day, Alex needs to ensure his Ubuntu servers are up to date with security patches and software updates to avoid vulnerabilities and performance issues. However, manually logging in every day and running apt list --upgradable wastes about 10 minutes daily, totaling over an hour per week just to check updates. On some days, he forgets or procrastinates, which leaves his servers exposed to risks. Imagine if Alex could automate this tedious task and receive a simple email only when updates are actually available. That’s exactly what this n8n workflow solves.

2. What This Automation Does

This workflow automatically connects your server over SSH daily and runs the apt list --upgradable command. Here’s what happens when it runs:

  • Runs a scheduled daily trigger to kick off the workflow.
  • Establishes an SSH connection to your VPS to list any packages that can be upgraded.
  • Processes the raw output into a neat HTML bullet-point list of upgradable packages.
  • Checks if there are any updates listed; if none, it stops without sending anything.
  • If updates exist, it sends a well-formatted notification email to your chosen address.
  • Lets you customize who gets notified and when, so you only act on meaningful alerts.

By automating this, Alex saves over 60 minutes a week and reduces the risk of missing critical updates, improving server security and stability seamlessly.

3. Prerequisites ⚙️

  • n8n Account (cloud or self-hosted instance)
  • SSH access credentials (password-based in this case) to your Linux server
  • SMTP email account credentials to send notifications (Gmail, Outlook, or any SMTP server)
  • Basic understanding of server package management using apt

4. Step-by-Step Guide to Build This Workflow

Step 1: Set up the Schedule Trigger to Run Daily

Open n8n, start a new workflow. Add the Schedule Trigger node from the nodes panel.

  • Set the interval to “Daily” with default settings (every 24 hours).
  • You should see the trigger firing daily at midnight UTC by default.
  • This node starts the workflow regularly without manual intervention.
  • Common mistake: forgetting to save the node after configuration.

Step 2: Add the SSH Node to List Upgradable Packages

Add the SSH node. Configure it to connect to your VPS via SSH:

  • In the command field, enter: apt list --upgradable
  • Set your SSH credentials with your server IP, username, and password (or key if preferred).
  • Test the connection using the node’s test feature to verify access.
  • Your node will output the list of all packages that have updates available.
  • Common mistake: incorrect SSH credentials or firewall blocking connection.

Step 3: Format the Output as an HTML List Using the Code Node

Add a Code node, select JavaScript mode. This node converts the plain-text output to an HTML bullet list.

Use this exact code snippet for the node:

function formatStdoutAsHtmlList(stdoutData) {
    const htmlListItems = stdoutData.split('n').map((line) => {
        if (line.trim() && line !== "Listing...") {
            return `
  • ${line.trim()}
  • `; } }).filter(item => item); return { htmlList: `
      ${htmlListItems.join('')}
    ` }; } return formatStdoutAsHtmlList($input.first().json.stdout);

    This code filters out the header line “Listing…” and empty lines, building an HTML

      list for email formatting.

      Expected result: JSON output with an htmlList property containing formatted HTML.

      Common mistake: accidentally deleting the filter condition, causing empty list items.

      Step 4: Add an If Node to Check If Updates Exist

      Add an If node to conditionally branch the workflow.

      • In the conditions, set left value to {{$json.htmlList}} and check if it does not equal

          precisely.

        • If true, it means updates are present, workflow continues to send email.
        • If false, the workflow stops here silently.
        • Common mistake: using a non-exact string check can lead to emails even if no updates.

        Step 5: Add the Email Send Node for Notifications

        Add the Email Send node configured with SMTP credentials.

        • Set “From” and “To” email addresses appropriately.
        • Copy this HTML for the email body to include the updates list:
        • The following packages can be updated on your server:
          
          {{ $json.htmlList }}
          
          Please login and perform upgrade.
        • Email subject: “Server needs updates”
        • Send a test email to verify the configuration.
        • Common mistake: forgetting to update “From” and “To” email addresses, causing delivery failure.

        Step 6: Link All Nodes Correctly

        Connect nodes in this order:

        • Schedule Trigger → SSH → Code (Format as HTML list) → If → Email Send
        • This ensures data flows only when updates exist.

        Step 7: Add Sticky Notes for Workflow Documentation

        Add Sticky Note nodes to describe what the workflow does and instructions to update email addresses. This is optional but improves clarity for future edits.

        5. Customizations ✏️

        • Switch to SSH Key Authentication: Replace Password credentials with SSH key in the SSH node for improved security.
        • Send Email to Multiple Recipients: In the Email Send node’s “toEmail” field, add comma-separated emails like [email protected], [email protected].
        • Change Update Command for Different Distros: Modify SSH node command field to yum check-update for CentOS or dnf check-update for Fedora systems.
        • Customize Email Subject: In the Email Send node, append date dynamically like Server needs updates - {{ $now.toISOString().slice(0,10) }}.

        6. Troubleshooting 🔧

        • Problem: “SSH connection timed out”
          Cause: Firewall blocking SSH port or wrong IP.
          Solution: Verify server IP, open port 22 in firewall, test ping, update credentials in SSH node.
        • Problem: “Email not sent”
          Cause: Incorrect SMTP credentials or from/to emails.
          Solution: Re-check SMTP settings, test with different SMTP provider, verify recipient email formatting.
        • Problem: “Empty updates list sent”
          Cause: If node condition configured incorrectly to detect empty list.
          Solution: Make sure If node checks that $json.htmlList !== '

            ' exactly.

          7. Pre-Production Checklist ✅

          • Test SSH node independently to confirm it lists upgradable packages.
          • Manually run the workflow and verify email is sent only when packages are listed.
          • Confirm email addresses in Email node are correct and reachable.
          • Backup your n8n workflows regularly, especially before major edits.

          8. Deployment Guide

          Once tested, activate your workflow by toggling it live in n8n.

          Ensure you have proper monitoring enabled for node errors in n8n to be notified of connection issues.

          This workflow can be hosted on your cloud or on a self-hosted n8n instance for full control. For self-hosting, check platforms like Hostinger for simple setups.

          9. FAQs

          • Q: Can I use private key authentication instead of password in SSH?
            A: Yes, you can configure SSH node to use private keys for better security.
          • Q: Does sending emails consume API credits?
            A: No, SMTP email sending does not use API credits in n8n.
          • Q: Can this workflow work on non-Debian based servers?
            A: Yes, but you must update the SSH command to the package manager your server uses.

          10. Conclusion

          By following this guide, you’ve built a reliable n8n workflow that automatically checks your VPS for upgradable packages every day and sends you an email alert only when necessary.

          This saves you around 10 minutes daily, helping you keep your server secure and up to date without manual effort.

          Next, consider automating the actual upgrade process or integrating with Slack for update alerts.

          Keep experimenting with n8n to tailor your server management exactly how you want it!

        Related Workflows

        Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

        Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
        Form Trigger
        Google Sheets
        Gmail
        +37
        Free

        AI SEO Blog Writer Automation in n8n (Beginner Guide)

        A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
        AI Agent
        Google Sheets
        httpRequest
        +5
        Free

        Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

        This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
        scheduleTrigger
        httpRequest
        jira
        +5
        Free

        Automate Telegram Invoices to Notion with AI Summaries & Reports

        Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
        lmChatGoogleGemini
        telegramTrigger
        notion
        +9
        Free

        Automate Email Replies with n8n and AI-Powered Summarization

        Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
        emailReadImap
        vectorStoreQdrant
        emailSend
        +12
        Free

        Automate Email Campaigns Using n8n with Gmail & Google Sheets

        This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
        googleSheets
        gmail
        code
        +5
        Free