Get scp to work over ssh/kvm
Sapan Bhatia [Wed, 19 Mar 2014 05:53:52 +0000 (01:53 -0400)]
scp_forward_agent.py [new file with mode: 0755]

diff --git a/scp_forward_agent.py b/scp_forward_agent.py
new file mode 100755 (executable)
index 0000000..f43638f
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+# Run this script as:
+# scp -S scp_forward_agent.py user@node
+
+import sys
+import os
+
+new_args = []
+fixed = False
+for arg in sys.argv[1:]:
+       if ('-oForwardAgent=no'==arg):
+               arg = '-oForwardAgent=yes'
+               fixed = True
+       new_args.append(arg)
+
+if (not fixed):
+       new_args = ['-oForwardAgent=yes'] + new_args
+
+os.execv('/usr/bin/ssh',['/usr/bin/ssh']+new_args)