ssh - ovigia/distrosnetinstall GitHub Wiki

#ssh

Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network.[1] The best known example application is for remote login to computer systems by users.

SSH provides a secure channel over an unsecured network in a client-server architecture, connecting an SSH client application with an SSH server.[2] Common applications include remote command-line login and remote command execution, but any network service can be secured with SSH. The protocol specification distinguishes between two major versions, referred to as SSH-1 and SSH-2.

índice

links

dicas

bash completion após Include config.d/*

Edit the /usr/share/bash-completion/bash_completion file as sudo and add this function just before a function called _known_hosts_real():

# Helper function to locate ssh included files in configs
# This function look for the "Include" keyword in ssh config files and include
# them recursively adding each result to the config variable
_included_ssh_config_files()
{
    [ $# -lt 1 ](/ovigia/distrosnetinstall/wiki/-$#--lt-1-) && echo "error: $FUNCNAME: missing mandatory argument CONFIG"
    local configfile i f
    configfile=$1
    local included=$( command sed -ne 's/^[:blank:](/ovigia/distrosnetinstall/wiki/:blank:)*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][:blank:](/ovigia/distrosnetinstall/wiki/:blank:)\{1,\}\([^#%]*\)\(#.*\)\{0,1\}$/\1/p' "${configfile}" )
    for i in ${included[@]}; do
        # Check the origin of $configfile to complete relative included paths on included
        # files according to ssh_config(5):
        #  "[...] Files without absolute paths are assumed to be in ~/.ssh if included in a user
        #   configuration file or /etc/ssh if included from the system configuration file.[...]"
        if ! [ "$i" =~ ^\~.*](/ovigia/distrosnetinstall/wiki/^\/.*-); then
            if [ "$configfile" =~ ^\/etc\/ssh.* ](/ovigia/distrosnetinstall/wiki/-"$configfile"-=~-^\/etc\/ssh.*-); then
                i="/etc/ssh/$i"
            else
                i="$HOME/.ssh/$i"
            fi
        fi
        __expand_tilde_by_ref i
        # In case the expanded variable contains multiple paths
        for f in ${i}; do
            if [ -r $f ]; then
                config+=( "$f" )
                # The Included file is processed to look for Included files in itself
                _included_ssh_config_files $f
            fi
        done
    done
} # _included_ssh_config_files()

Then add the following code:

  # "Include" keyword in ssh config files
    for i in "${config[@]}"; do
        _included_ssh_config_files "$i"
    done

Just before a line that looks like:

  # Known hosts files from configs
    if [ ${#config[@]} -gt 0 ](/ovigia/distrosnetinstall/wiki/-${#config[@]}--gt-0-); then
        local OIFS=$IFS IFS=$'\n' j
        local -a tmpkh

:read !command