Shell Fallback - Command Reference

When SFTP/SCP are blocked, the plugin can use shell command pipelines for file transfers. This page documents the shell commands used.

Overview

Why Shell Fallback?

When to Enable

Transfer Methods

Method 1: Raw cat Stream

Direct streaming for simple cases:

Download

cat /remote/path/file.txt

Upload

cat > /remote/path/file.txt

Method 2: dd with Block Size

Controlled block transfer:

Download with Offset

dd if=/remote/path/file.txt bs=16384 skip=10

Upload with Append

dd of=/remote/path/file.txt bs=16384 seek=10 conv=notrunc

Method 3: Base64 Encoding

Most robust fallback for restrictive environments:

Download with Base64

base64 -w 0 /remote/path/file.txt

Upload with Base64

base64 -d > /remote/path/file.txt

Resume Strategies

Base64 Resume Alignment

Base64 encoding has special handling for resume:

Resume Example

# File is 10000 bytes, already have 3000
# 3000 bytes = 1000 blocks of 3 bytes
# Base64: 1000 * 4 = 4000 characters to skip

base64 -w 0 file.txt | tail -c +4001 | base64 -d >> partial.file

Directory Operations

List Directory

ls -la /remote/path/

Create Directory

mkdir -p /remote/path/newdir

Remove File

rm -f /remote/path/file.txt

Remove Directory

rm -rf /remote/path/olddir

Rename/Move

mv /remote/path/old.txt /remote/path/new.txt

Get File Info

stat /remote/path/file.txt

Shell Detection

Available Commands

Plugin tests for command availability:

which cat
which dd
which base64
which ls
which mkdir
which rm
which mv
which stat

Fallback Order

  1. Try SFTP native operations
  2. Try SCP commands
  3. Try shell cat/dd
  4. Try base64 encoding
  5. Last resort: chunked base64

SCP Shell Mode

SCP with Shell Fallback

Some hosts need shell for SCP operations:

SCP Send

scp -t /remote/path/file.txt

SCP Receive

scp -f /remote/path/file.txt

SCP Shell Protocol

# Plugin sends:
T1234567890 0 1234567890 0  (timestamps)
C0644 1234 file.txt  (file mode, size, name)
[...file content...]
\0  (null terminator)

# Server responds with:
\0  (OK)
\1error  (Error)
\2fatal error  (Fatal)

Error Handling

Command Not Found

Permission Denied

Command Timeout

Partial Transfer

Performance Considerations

Base64 Overhead

Block Size Tuning

Latency Impact

Security Notes

Command Injection Protection

Shell Quoting

# Filename with spaces:
cat "/remote/path/my file.txt"

# Filename with special chars:
cat '/remote/path/file$var.txt'
Note: Shell fallback prioritizes compatibility over terminal semantics. Some interactive features may not work.
Tip: If shell transfer works but is slow, try enabling compression in SSH settings or use base64 for binary files only.

Back to index