Skip to main content

SSH/SFTP file transfer and synchronization CLI with atomic operations

Project description

VaultXfer

Python Version License SSH Protocol PyPI

A secure and atomic file transfer and synchronization tool built on SSH/SFTP protocols.

Table of Contents

Overview

VaultXfer is a robust command-line interface designed for secure file operations between local and remote systems. Leveraging the proven security of SSH/SFTP protocols, it provides atomic operations and intelligent synchronization for critical data transfer scenarios.

Key Features

  • Atomic File Operations: Guaranteed data integrity through temporary file staging and atomic moves
  • Multiple Synchronization Modes: Unidirectional push/pull and bidirectional synchronization with conflict resolution
  • Pattern-Based Filtering: Advanced include/exclude patterns for selective file operations
  • Progress Monitoring: Real-time transfer metrics with human-readable formatting
  • Flexible Authentication: Support for SSH keys, password authentication, and custom known_hosts management
  • Recursive Directory Handling: Complete directory tree operations with configurable depth

Installation

Prerequisites

  • Python 3.10+
  • SSH server access on target systems
  • Appropriate file permissions for source and destination paths

Package Installation

pip install vaultxfer

Source Installation

git clone https://github.com/agace/vaultxfer.git
cd vaultxfer
pip install -e .

Verification

vaultxfer --version

Quick Start

Basic File Transfer

# Upload file to remote host
vaultxfer user@remotehost put local_file.txt /remote/destination/

# Download file from remote host
vaultxfer user@remotehost get /remote/file.txt local_copy.txt

Directory Synchronization

# One-way synchronization (local → remote)
vaultxfer user@remotehost sync --push ./local_dir /remote/dir/

# Bidirectional synchronization with conflict resolution
vaultxfer user@remotehost sync --bidirectional ./project /remote/project -r

Advanced Authentication

# Using specific SSH key and custom port
vaultxfer -i ~/.ssh/custom_key -p 2222 user@remotehost put sensitive_data.db /secure/storage/

Command Reference

Global Options

Option Description
-p, --port PORT SSH port (default: 22)
-i, --identity FILE Private key file path
--known-hosts FILE Use a specific known_hosts file
--timeout SECONDS SSH connection timeout (default: 30)
-v, --version Show version

Commands

Command Usage Description
put vaultxfer user@host put file.txt /remote/path/ Upload local file
get vaultxfer user@host get /remote/path/file.txt local.txt Download remote file
sync vaultxfer user@host sync [mode] local/ /remote/ Synchronize folders

Sync Options

Option Description
--push Sync local → remote
--pull Sync remote → local
--bidirectional Sync both sides with conflict resolution
-r, --recursive Recursive directory processing
--include GLOB Include files matching pattern (multiple allowed)
--exclude GLOB Exclude files matching pattern (multiple allowed)

Advanced Usage

Pattern-Based Filtering

vaultxfer user@remotehost sync --push -r photos /remote/photos \
  --include '*.jpg' '*.png' '*.gif' \
  --exclude 'temp_*' '.DS_Store'

Custom SSH Configuration

vaultxfer --known-hosts ~/.ssh/custom_known_hosts --timeout 60 user@remotehost get /important/data.db ./backup/

Recursive Operations

vaultxfer user@remotehost sync --bidirectional -r data /remote/data

Atomic Operation Flow

  1. Temporary File Creation: Files are transferred to temporary locations

  2. Integrity Verification: Hash verification

  3. Atomic Commit: Atomic move operation to final destination

  4. Cleanup: Temporary file removal upon success or failure

Conflict Resolution Logic

  • Timestamp Comparison: Files within 5-second window are considered conflicting

  • Conflict Preservation: Conflicting files are preserved with .local and .remote extensions

  • Newer File Wins: Older files are overwritten by newer versions

Security Considerations

Authentication Methods

  • SSH Key Authentication (Recommended): Uses public-key cryptography

  • Password Authentication: Secure prompt with no echo

  • Host Verification: Custom known_hosts file support

Data Protection

  • All transfers occur over encrypted SSH tunnels

  • No sensitive data persistence in logs or temporary files

  • Temporary files are properly cleaned up after operations

Best Practices

  • Use SSH keys instead of passwords for automation

  • Regularly update and manage known_hosts files

  • Implement appropriate file permissions on destination systems

  • Use include/exclude patterns to limit scope of operations

Troubleshooting

“Permission denied” errors

Ensure your remote user has write permissions to target directories. When syncing, both parent directories and intermediate folders must be writable. On the remote host, check ownership and permissions:

ssh user@host 'ls -ld /path /path/subdir'

“Local file not found” during push

Confirm the local path you pass is correct and that you’re running the command from the expected working directory, or provide absolute paths.

Confusing path direction in sync

In the CLI:

  • The first path is local.

  • The second path is remote.

  • --push and --pull decide direction of change propagation.

  • --bidirectional reconciles both sides.

Large directories

Use -r for deep trees. Consider --include, --exclude to limit scope.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vaultxfer-0.1.1.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vaultxfer-0.1.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file vaultxfer-0.1.1.tar.gz.

File metadata

  • Download URL: vaultxfer-0.1.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for vaultxfer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2d538ea239a8681a4b37ba57c1743dfbe2725f33db3dc03b71a5de20d99dd789
MD5 fb7b9a167f9cae219da715ae6ac55f01
BLAKE2b-256 6cd042950c32eda71736ee88fb8c3a86ec8024138729e150e7bed80599ecca0d

See more details on using hashes here.

File details

Details for the file vaultxfer-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: vaultxfer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for vaultxfer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c807bcb21d2d738edfaad8829211ae99bdbf915e297f475cbb9a17b19bd1e0c0
MD5 601a0acc31a8183967cf1386fe8d4e8f
BLAKE2b-256 1e941a7ed0a6c2fc018a38b5f5cf2e9658aa664e34cb5b7994dae937e2aa431d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page