aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-10-07 18:13:12 -0300
committerSilvio Rhatto <rhatto@riseup.net>2019-10-07 18:13:12 -0300
commitebbe4622db99554a569e4b6161773f7378e0f7c0 (patch)
tree59abd4dbfc0bd3b815884fff756bd235415f0e29
parent74fc7a2d5ebc7c6081aae754a53f1bda57564dc8 (diff)
downloadkvmx-ebbe4622db99554a569e4b6161773f7378e0f7c0.tar.gz
kvmx-ebbe4622db99554a569e4b6161773f7378e0f7c0.tar.bz2
Adds kvmx_sshfs
-rwxr-xr-xkvmx24
1 files changed, 21 insertions, 3 deletions
diff --git a/kvmx b/kvmx
index 4fcc084..616631d 100755
--- a/kvmx
+++ b/kvmx
@@ -66,9 +66,9 @@ function __kvmx_ssh_command {
fi
# See http://blog.djm.net.au/2013/11/chacha20-and-poly1305-in-openssh.html
- SSH_OPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=FATAL -o ProxyCommand=none -o Ciphers=chacha20-poly1305@openssh.com -o User=$SSH_LOGIN $ssh_key_param"
- SSH_COMMAND="ssh $SSH_OPTS"
- SCP_COMMAND="scp $SSH_OPTS"
+ SSH_OPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=FATAL -o ProxyCommand=none -o Ciphers=chacha20-poly1305@openssh.com $ssh_key_param"
+ SSH_COMMAND="ssh $SSH_OPTS -o User=$SSH_LOGIN"
+ SCP_COMMAND="scp $SSH_OPTS -o User=$SSH_LOGIN"
}
# Create a guest entry at the global user config folder
@@ -784,6 +784,24 @@ EOF
fi
}
+# Mount a guest folder into the host using sshfs
+function kvmx_sshfs {
+ local folder="$1"
+ local mountpoint="$2"
+
+ if [ -z "$mountpoint" ]; then
+ kvmx_usage
+ fi
+
+ if ! which sshfs &> /dev/null; then
+ echo "$BASENAME: this action requires sshfs to be installed on your system."
+ exit 1
+ fi
+
+ SSH="`cat $SSHFILE`"
+ sshfs $SSH_LOGIN@127.0.0.1:$folder $mountpoint $SSH_OPTS -o nonempty -p $SSH
+}
+
# Get guest PID
function kvmx_pid {
if [ -e "$PIDFILE" ]; then