Skip to content
Snippets Groups Projects
Commit 334d8725 authored by Simon Tatham's avatar Simon Tatham
Browse files

New script contrib/plinkfs.

This is a small wrapper on 'sshfs' which allows it to use Plink as its
transport. Mostly useful for when I've already got a PuTTY session
open to a given host with connection sharing enabled, and want to
tunnel over that rather than painstakingly re-establishing a separate
connection.
parent 77bd6b2a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# Wrapper around the FUSE 'sshfs' client, which arranges to use Plink
# as the SSH transport subcommand.
#
# This is not totally trivial because sshfs assumes slightly more of
# OpenSSH's command-line syntax than Plink supports. So we actually
# give sshfs a subcommand which is this script itself, re-invoked with
# the --helper option.
import sys
import os
import shlex
if sys.argv[1:2] == ["--helper"]:
# Helper mode. Strip OpenSSH-specific '-o' options from the
# command line, and invoke Plink.
plink_command = ["plink"]
it = iter(sys.argv)
next(it) # discard command name
next(it) # discard --helper
for arg in it:
if arg == "-o":
next(it) # discard -o option
elif arg.startswith("-o"):
pass
else:
plink_command.append(arg)
os.execvp(plink_command[0], plink_command)
else:
# Normal mode, invoked by the user.
sshfs_command = [
"sshfs", "-o", "ssh_command={} --helper".format(
os.path.realpath(__file__))
] + sys.argv[1:]
os.execvp(sshfs_command[0], sshfs_command)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment