npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@badc0d3/piece-bash-runner

v1.2.0

Published

Run bash commands with NFS/SMB mounting support in Activepieces

Downloads

38

Readme

Bash Command Runner for Activepieces

Execute bash commands and scripts with support for mounting NFS and SMB network drives in your Activepieces workflows.

Features

  • 🖥️ Execute Bash Commands: Run any bash command or script
  • 📁 Network Drive Support: Mount NFS and SMB/CIFS drives before executing commands
  • 🔒 Two Execution Modes:
    • Standard: Direct execution with mount privileges
    • Sandboxed: Docker-based execution with resource limits
  • 🔑 Authentication Support: Username/password for SMB shares
  • Flexible Configuration: Custom mount options and working directories
  • 📊 Output Capture: Separate stdout/stderr capture

Installation

NPM

npm install @badc0d3/piece-bash-runner

In Activepieces

  1. Copy the piece to your Activepieces pieces directory
  2. Restart your Activepieces instance
  3. The Bash Command Runner will be available in your flows

Usage

Basic Command Execution

#!/bin/bash
echo "Hello from Bash!"
ls -la
pwd

Mount NFS Drive and Process Files

#!/bin/bash
# Files will be available at /mnt/network after mounting
find /mnt/network -name "*.txt" -exec wc -l {} +

Mount Configuration:

  • Type: NFS
  • Source: server.local:/exports/data
  • Mount Point: /mnt/network
  • Options: rw,sync

Mount SMB Share with Authentication

#!/bin/bash
# Copy files from SMB share
cp -r /mnt/network/documents /tmp/backup/

Mount Configuration:

  • Type: SMB/CIFS
  • Source: //server.local/share
  • Mount Point: /mnt/network
  • Username: myuser
  • Password: [use secure text]

Actions

Run Bash Command (Standard)

Executes bash commands directly on the host system.

Properties:

  • Bash Command: The command or script to execute
  • Mount Configuration: Optional NFS/SMB mount settings
  • Working Directory: Directory to execute commands in
  • Timeout: Maximum execution time
  • Capture Output: Whether to capture stdout/stderr separately

Requirements:

  • For NFS: nfs-common package installed
  • For SMB: cifs-utils package installed
  • Mount privileges (may require root or sudo)

Run Bash Command (Sandboxed)

Executes bash commands in a Docker container with automatic installation of mount utilities.

Properties:

  • Bash Command: The command or script to execute
  • Mount Configuration: Optional NFS/SMB mount settings
  • Docker Image: Base image to use (default: ubuntu:latest)
  • Timeout: Maximum execution time
  • Run as Root: Toggle to run commands as root user (default: false, less secure)

Security Features:

  • Privileged operations (mounting) run as root
  • User commands run as non-root user (activepieces UID/GID 1001) without sudo access by default
  • Option to run commands as root when explicitly needed
  • Proper privilege separation between system operations and user code
  • Resource limits (512MB RAM, 50% CPU)
  • Automatic cleanup after execution

Required Permissions:

  • Docker socket access: -v /var/run/docker.sock:/var/run/docker.sock
  • Container runs with SYS_ADMIN capability for mounting

Mount Configuration

NFS Options

Common NFS mount options:

  • rw: Read-write access
  • ro: Read-only access
  • sync: Synchronous writes
  • async: Asynchronous writes
  • nolock: Disable file locking
  • vers=3 or vers=4: NFS version

SMB/CIFS Options

Common SMB mount options:

  • rw: Read-write access
  • ro: Read-only access
  • vers=1.0, vers=2.0, vers=3.0: SMB protocol version
  • domain=WORKGROUP: Domain name
  • uid=1000: User ID for file ownership
  • gid=1000: Group ID for file ownership

Security Considerations

Standard Version

  • Runs with the same privileges as Activepieces
  • Mount operations may require elevated privileges
  • Consider using restricted mount options

Sandboxed Version

  • Runs in Docker container with limited resources
  • Mounting operations performed as root for security
  • User commands execute as non-root user without sudo privileges
  • Container has SYS_ADMIN capability for mounting
  • Proper privilege separation ensures user code cannot perform system operations
  • Isolated from host system

Best Practices

  1. Use read-only mounts when possible (ro option)
  2. Store credentials securely using Activepieces secure text
  3. Unmount drives after use (handled automatically)
  4. Validate and sanitize file paths
  5. Use specific mount options to limit access

Examples

Backup Files from NFS

#!/bin/bash
# Create backup directory
mkdir -p /tmp/backup/$(date +%Y%m%d)

# Copy files from NFS mount
rsync -av /mnt/network/important/ /tmp/backup/$(date +%Y%m%d)/

# Create archive
tar -czf /tmp/backup-$(date +%Y%m%d).tar.gz /tmp/backup/$(date +%Y%m%d)/

echo "Backup completed successfully"

Process CSV Files from SMB Share

#!/bin/bash
# Find all CSV files
for file in /mnt/network/data/*.csv; do
  echo "Processing: $file"
  # Count lines
  lines=$(wc -l < "$file")
  echo "Lines: $lines"
  
  # Get first line (headers)
  head -1 "$file"
  echo "---"
done

System Monitoring Script

#!/bin/bash
# No mount needed for system monitoring
echo "=== System Information ==="
echo "Hostname: $(hostname)"
echo "Uptime: $(uptime)"
echo ""
echo "=== Disk Usage ==="
df -h
echo ""
echo "=== Memory Usage ==="
free -h

Running Commands as Root (When Needed)

For operations that require root privileges, enable the "Run as Root" option:

#!/bin/bash
# Example: Installing system packages (requires root)
apt-get update
apt-get install -y htop iotop

# Example: Modifying system files
echo "192.168.1.100 myserver.local" >> /etc/hosts

# Example: System administration tasks
systemctl status docker

Note: Running as root should only be used when absolutely necessary. The default non-root execution provides better security.

Troubleshooting

Mount Permission Denied

  • Ensure the user has mount privileges
  • For Docker, ensure SYS_ADMIN capability is granted
  • Check AppArmor/SELinux policies

NFS Mount Fails

  • Verify NFS server is accessible: showmount -e server
  • Check firewall rules (port 2049 for NFS)
  • Try different NFS versions: vers=3 or vers=4

SMB Mount Fails

  • Verify SMB share is accessible: smbclient -L //server
  • Check credentials and escape special characters
  • Try different SMB versions: vers=1.0, vers=2.0, vers=3.0

Docker Socket Error

  • Mount Docker socket: -v /var/run/docker.sock:/var/run/docker.sock
  • Ensure Docker is running
  • Check Docker permissions

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT