#!/bin/bash cliHandleSshCommands() { local action="$initial_command2" local arg="$initial_command3" case "$action" in ""|help) cliShowSshHelp ;; status) local pw="off"; hostSshPasswordAuthEnabled && pw="on" echo "user=$(hostSshUser) password_login=$pw authorized_keys=$(hostSshKeyCount)" ;; key-add) [[ -z "$arg" ]] && { isNotice "Usage: ssh key-add "; cliShowSshHelp; return; } hostSshKeyAdd "$arg" ;; key-remove) [[ -z "$arg" ]] && { isNotice "Usage: ssh key-remove "; cliShowSshHelp; return; } hostSshKeyRemove "$arg" ;; password-auth) [[ -z "$arg" ]] && { isNotice "Usage: ssh password-auth "; cliShowSshHelp; return; } hostSshSetPasswordAuth "$arg" ;; generate) webuiGenerateSshAccess ;; *) isNotice "Unknown ssh action: $action" cliShowSshHelp ;; esac }