Table of Contents

Enum SshScpPathQuoting

Namespace
SshSharp.Scp
Assembly
SshSharp.dll

How SCP writes the remote path on the command line it runs on the server (scp -t to upload, scp -f to download). Set it as PathQuoting.

public enum SshScpPathQuoting

Fields

DoubleQuote = 2

scp -t -- "C:\path": one double-quoted word, for Windows OpenSSH servers whose default shell is cmd.exe (the default there). Refuses what double quotes cannot carry safely through cmd.exe, PowerShell and the program's own argument parsing: control characters, ", the expansions %, !, $ and `, PowerShell's typographic double quotes, the characters Windows forbids in names (< > | * ?), a - first, and a </code> at the end (write C:\dir or C:/dir/ instead).

None = 1

scp -t /path: the path as given, with no quotes and no --, for the SCP servers built into network devices (Cisco IOS, MikroTik RouterOS and others), which read the line themselves, without a shell. Only letters, digits and / . _ - : + @ = are allowed, and not -, = or @ first, so the path cannot be split, taken for an option, expanded or run anything even where a shell does read the line. Any other path is refused.

Posix = 0

The default: scp -t -- '/path', one single-quoted shell word, with each ', </code> and ! in it written outside the quotes, escaped (''', '\', '!'). Safe for any path with the login shells sshd runs the line with: sh, bash, zsh, fish and tcsh. Refuses an empty path, NUL and line breaks.

Remarks

Only Posix is safe for any path. The other modes are for servers that do not read the line as a POSIX shell does. They refuse, before anything is sent, the paths they cannot pass on safely, and should be given only paths the application controls.