Loading...

Knowledge Base
Up to 75% off on hosting for WordPress websites and online stores

Bluehost VPS: How to Manage n8n via SSH

Knowing how to manage n8n via SSH is crucial for maintaining control over your workflow automation, especially when running on remote servers like a Bluehost VPS. SSH access allows you to securely monitor, configure, and troubleshoot your n8n Docker container directly, ensuring minimal downtime and quick issue resolution.

This guide helps you efficiently manage your existing n8n Docker container on a Bluehost VPS with Docker preinstalled. It focuses on essential maintenance tasks—monitoring logs, updating environment settings, backing up data, and troubleshooting—to keep your automation workflows running smoothly and reliably.

 

SSH into Your Server

Connect to your Bluehost VPS using SSH:

ssh your-username@your-server-ip

Replace your-username and your-server-ip with your actual credentials.

Verify the n8n Container Status

Check the status of the existing n8n container (running or stopped):

docker ps -a | grep n8n

To view only running containers:

docker ps | grep n8n

Example output:

[root@50-1-1-123 ~]# docker ps | grep n8n
71d214358d22   docker.n8n.io/n8nio/n8n   "tini -- /docker-ent…"   27 hours ago   Up 27 hours   0.0.0.0:5678->5678/tcp   n8n

Monitor n8n Logs

View real-time logs to monitor n8n’s operation or troubleshoot:

docker logs -f n8n

Example output summary:

No encryption key found - Auto-generating and saving to: /home/node/.n8n/config
Initializing n8n process
n8n ready on ::, port 5678
Migrations in progress, please do NOT stop the process.
...
Version: 1.118.2
Editor is now accessible via:
http://localhost:5678
Owner was set up successfully
Pruning old insights data

Restart, Stop, or Start the n8n Container

Use these commands to restart or control the container as needed:

  • Restart the container (useful after config changes):
    docker restart n8n
  • Stop the container gracefully:
    docker stop n8n
  • Start the container:
    docker start n8n

Note: Restarting helps apply configuration changes and frees up resources.

Access the n8n Container Shell for Advanced Management

Open an interactive shell inside the running container:

docker exec -it n8n /bin/sh

Use this shell for debugging or manual file operations. Exit with:

exit

Backup and Restore Workflows

Your workflows and credentials are stored inside the container or its mounted volume (commonly at /home/node/.n8n).

  • To back up your data from the container to the host:
    docker cp n8n:/home/node/.n8n ~/n8n_backup
  • To restore, copy backed-up files back into the container volume or host mount point, then restart the container if needed.

Update Environment Variables

To modify environment variables (e.g., enable basic auth), follow these steps:

  1. Stop the container:
    docker stop n8n
  2. Remove the container:
    docker rm n8n
  3. Run the container using your existing configuration plus new environment variables (replace volumes and ports as per your setup):
    docker run -d \
      --name n8n \
      -p 5678:5678 \
      -v ~/n8n_data:/home/node/.n8n \
      -e N8N_BASIC_AUTH_ACTIVE=true \
      -e N8N_BASIC_AUTH_USER=dummyuser \
      -e N8N_BASIC_AUTH_PASSWORD=dummypassword \
      n8nio/n8n
    

Example output after running the above command:

[root@50-1-1-123 ~]# docker run -d \
  --name n8n \
  -p 5678:5678 \
  -v ~/n8n_data:/home/node/.n8n \
  -e N8N_BASIC_AUTH_ACTIVE=true \
  -e N8N_BASIC_AUTH_USER=dummyuser \
  -e N8N_BASIC_AUTH_PASSWORD=dummypassword \
  n8nio/n8n
564cc375304d2498a49597e3170d30f62086aebf29930c4f4389cbc49cf78148

4. Verify environment variables are set:

docker inspect n8n | grep Env -A10

Example output:

[root@50-1-1-123 ~]# docker inspect n8n | grep Env -A10
            "Env": [
                "N8N_BASIC_AUTH_ACTIVE=true",
                "N8N_BASIC_AUTH_USER=dummyuser",
                "N8N_BASIC_AUTH_PASSWORD=dummypassword",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "NODE_VERSION=22.21.0",
                "YARN_VERSION=1.22.22",
                "NODE_ICU_DATA=/usr/local/lib/node_modules/full-icu",
                "NODE_ENV=production",
                "N8N_RELEASE_TYPE=stable",
                "SHELL=/bin/sh"

Update n8n to a Newer Version

  1. Stop the container:
    docker stop n8n
  2. Remove the container (your data will be preserved if you use volumes):
    docker rm n8n
  3. Pull the latest n8n Docker image:
    docker pull n8nio/n8n
  4. Restart the container with your existing configuration and volume mappings.

Troubleshooting Container Name Conflicts

If you receive an error like this when trying to start the container:

docker: Error response from daemon: Conflict. The container name "/n8n" is already in use by container "container_id".
You have to remove (or rename) that container to be able to reuse that name.

Fix it by:

  • Check existing containers:
    docker ps -a | grep n8n
  • Remove the old container if it’s no longer needed:
    docker stop n8n
    
    docker rm n8n
  • Or start the existing stopped container:
    docker start n8n
  • If you want to run a new instance alongside, use a different container name and port:
    docker run -d --name n8n_new -p 5679:5678 -v ~/n8n_data:/home/node/.n8n n8nio/n8n

Inspect Container Configuration and Environment Variables

Use this to check environment variables and port bindings:

docker inspect n8n

Summary

You now have the core commands and knowledge to manage your existing n8n Docker container via SSH effectively, including:

  • Checking status and logs
  • Controlling container lifecycle
  • Backing up and restoring workflows
  • Adjusting environment variables
  • Updating the n8n image
  • Troubleshooting common Docker container issues

Loading...