ComfyUI-SCP-nodes
save images to SCP upload, direct to webserver
SaveImageSCP - ComfyUI Custom Node
A custom ComfyUI node that automatically saves generated images locally and uploads them to a remote server via SCP (Secure Copy Protocol).
Features
- 🖼️ Saves images locally in ComfyUI's output directory
- 🚀 Automatic SCP upload to predefined server locations
- 📁 Multiple profile support for different remote paths
- 🔐 Secure authentication via .env file
- ⚡ Easy profile switching via dropdown menu
- 🎛️ Optional upload toggle
Installation
1. Install the Node
Copy the files to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes
mkdir SaveImageSCP
cd SaveImageSCP
# Copy these files:
# - SaveImageSCP.py
# - config.json
# - requirements.txt
2. Install Dependencies
pip install -r requirements.txt
Or manually install:
pip install paramiko python-dotenv
3. Configure Environment Variables
Create a .env file in your ComfyUI root directory (not in the custom_nodes folder):
cd /path/to/ComfyUI
nano .env
Add your SCP credentials:
SCP_HOST=your.server.com
SCP_PORT=22
SCP_USERNAME=your_username
SCP_PASSWORD="your_password"
Security Note: For production use, consider using SSH keys instead of passwords.
4. Configure Profiles
Edit config.json in the SaveImageSCP directory to define your upload profiles:
{
"profiles": {
"default": "/var/www/html/images/",
"portfolio": "/home/user/portfolio/images/",
"testing": "/tmp/comfyui/test/",
"production": "/var/www/production/gallery/",
"backup": "/mnt/backup/images/"
}
}
Each profile maps a name to a remote server path.
Usage
In ComfyUI Workflow
- Add the Save Image (SCP Upload) node to your workflow
- Connect an image output to the node's input
- Configure the node parameters:
- filename_prefix: Prefix for saved files (default: "ComfyUI")
- profile: Select from your configured profiles
- upload_enabled: Toggle SCP upload on/off
Node Parameters
| Parameter | Type | Description | |-----------|------|-------------| | images | IMAGE | Input images to save/upload | | filename_prefix | STRING | Prefix for filenames (e.g., "myproject") | | profile | DROPDOWN | Select upload destination profile | | upload_enabled | BOOLEAN | Enable/disable SCP upload |
Example Workflow
[Image Generation] → [SaveImageSCP]
├─ filename_prefix: "artwork"
├─ profile: "portfolio"
└─ upload_enabled: ✓
File Naming
Images are saved with sequential numbering:
artwork_00001.pngartwork_00002.pngartwork_00003.png
Troubleshooting
Upload Failed
Problem: "Upload failed" error in console
Solutions:
- Check
.envcredentials are correct - Verify server is reachable:
ping your.server.com - Test SSH access:
ssh [email protected] - Ensure remote directory exists and is writable
- Check firewall rules allow port 22 (or your custom SSH port)
SCP Configuration Incomplete
Problem: "SCP configuration incomplete" warning
Solution: Verify all required fields in .env are set:
- SCP_HOST
- SCP_USERNAME
- SCP_PASSWORD
Profile Not Found
Problem: Profile doesn't appear in dropdown
Solutions:
- Check
config.jsonsyntax is valid JSON - Restart ComfyUI after modifying
config.json - Ensure profile name doesn't contain special characters
Permission Denied
Problem: "Permission denied" during upload
Solutions:
- Verify remote directory permissions
- Check user has write access to target directory
- Try creating the directory manually first:
mkdir -p /remote/path
Security Considerations
Using SSH Keys (Recommended)
For better security, use SSH key authentication instead of passwords:
- Generate SSH key pair (if you don't have one):
ssh-keygen -t rsa -b 4096
- Copy public key to server:
ssh-copy-id [email protected]
- Modify
SaveImageSCP.pyto use key authentication:
# In _upload_via_scp method, replace password auth with:
ssh.connect(
hostname=self.scp_host,
port=self.scp_port,
username=self.scp_username,
key_filename='/path/to/private/key' # Add this line
)
File Permissions
Ensure .env file has restricted permissions:
chmod 600 .env
Network Security
- Use VPN or SSH tunneling for remote servers
- Consider using non-standard SSH ports
- Enable fail2ban on server to prevent brute force attacks
- Use strong passwords or preferably SSH keys
Advanced Configuration
Custom Port
If your SSH server uses a non-standard port, update .env:
SCP_PORT=2222
Automatic Directory Creation
The node automatically creates remote directories if they don't exist. Ensure your user has permission to create directories in the parent path.
Multiple Servers
To support multiple servers, you can:
- Create separate profile groups in
config.json - Prefix profile names with server identifier:
server1_default,server2_production
Development
Extending the Node
You can extend functionality by modifying SaveImageSCP.py:
- Add image format options (JPEG, WebP)
- Include compression settings
- Add metadata embedding
- Implement retry logic for failed uploads
- Add notification webhooks
License
This is a custom node for ComfyUI. Use freely in your projects.
Support
For issues or questions:
- Check the troubleshooting section
- Review ComfyUI logs for detailed error messages
- Verify your server configuration
- Test SCP connectivity independently
Changelog
Version 1.0.0
- Initial release
- Basic save and SCP upload functionality
- Profile support via config.json
- Environment-based authentication
- Automatic directory creation
📚 Citation
Academic Citation
If you use this codebase in your research or project, please cite:
@software{comfyui-scp-nodes,
title = {ComfyUI SCP nodes: Save and Upload to webservers automatically with Secure Copy},
author = {[Drift Johnson]},
year = {2025},
url = {https://github.com/MushroomFleet/ComfyUI-SCP-nodes},
version = {1.0.0}
}
