aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx15
-rw-r--r--kvmxfile6
2 files changed, 21 insertions, 0 deletions
diff --git a/kvmx b/kvmx
index ddd9498..4f0ff6e 100755
--- a/kvmx
+++ b/kvmx
@@ -881,6 +881,21 @@ function kvmx_ssh {
$ssh_env $SSH_COMMAND -p $SSH 127.0.0.1 $*
}
+# Enhanced SSH login into the guest
+function kvmx_login {
+ # This allows the usage of a custom login command
+ #
+ # It's not implemented directly in kvmx_ssh because it conflicts with use
+ # cases where SSH commands are read from stdin and not from positional
+ # arguments, like `echo something | kvmx_ssh`.
+ if [ -z "$1" ] && [ ! -z "$ssh_login_command" ]; then
+ # This needs the -t option to request a pseudo-terminal
+ kvmx_ssh -t $ssh_login_command
+ else
+ kvmx_ssh $*
+ fi
+}
+
# Get guest SSH key fingerprints
function kvmx_ssh_finger {
if ls $DATADIR/ssh/*.pub.* &> /dev/null; then
diff --git a/kvmxfile b/kvmxfile
index 975aa78..191b160 100644
--- a/kvmxfile
+++ b/kvmxfile
@@ -86,6 +86,12 @@ shared_folder_mountpoint="/home/$user/code/$VM"
#startup_rsync_to_guest="data:data:/var/data,code:$HOME/code:/home/user/code"
#poweroff_rsync_from_guest="data:/var/data:data,code:/home/user/code:$HOME/code"
+# SSH login command when using `kvmx login`
+# Login command when SSHing to the guest when no command is specified.
+# Yout might need to invoke a login shell so your environment is populated etc.
+#ssh_login_comman="tmux"
+#ssh_login_command="bash --login -c 'shell local myprofile'"
+
# Graphics
# See https://wiki.archlinux.org/index.php/QEMU#Graphics
#graphics="-vga std -nographic -vnc :$GUEST_DISPLAY"