A custom ComfyUI node that automatically saves generated images locally and uploads them to a remote server via SCP (Secure Copy Protocol).
- πΌοΈ 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
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.txtpip install -r requirements.txtOr manually install:
pip install paramiko python-dotenvCreate a .env file in your ComfyUI root directory (not in the custom_nodes folder):
cd /path/to/ComfyUI
nano .envAdd 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.
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.
- 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
| 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 |
[Image Generation] β [SaveImageSCP]
ββ filename_prefix: "artwork"
ββ profile: "portfolio"
ββ upload_enabled: β
Images are saved with sequential numbering:
artwork_00001.pngartwork_00002.pngartwork_00003.png
Problem: "Upload failed" error in console
Solutions:
- Check
.envcredentials are correct - Verify server is reachable:
ping your.server.com - Test SSH access:
ssh user@your.server.com - Ensure remote directory exists and is writable
- Check firewall rules allow port 22 (or your custom SSH port)
Problem: "SCP configuration incomplete" warning
Solution: Verify all required fields in .env are set:
- SCP_HOST
- SCP_USERNAME
- SCP_PASSWORD
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
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
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 user@your.server.com- 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
)Ensure .env file has restricted permissions:
chmod 600 .env- 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
If your SSH server uses a non-standard port, update .env:
SCP_PORT=2222The node automatically creates remote directories if they don't exist. Ensure your user has permission to create directories in the parent path.
To support multiple servers, you can:
- Create separate profile groups in
config.json - Prefix profile names with server identifier:
server1_default,server2_production
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
This is a custom node for ComfyUI. Use freely in your projects.
For issues or questions:
- Check the troubleshooting section
- Review ComfyUI logs for detailed error messages
- Verify your server configuration
- Test SCP connectivity independently
- Initial release
- Basic save and SCP upload functionality
- Profile support via config.json
- Environment-based authentication
- Automatic directory creation
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}
}