Ср, 21 февраля, 14:54

macOs / Linux ssh autocomplete hint

_complete_ssh_hosts ()
{
        COMPREPLY=()
        cur="${COMP_WORDS[COMP_CWORD]}"
        comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
                        cut -f 1 -d ' ' | \
                        sed -e s/,.*//g | \
                        grep -v ^# | \
                        uniq | \
                        grep -v "\[" ;
                cat ~/.ssh/config | \
                        grep "^Host " | \
                        awk '{print $2}'
                `
        COMPREPLY=( $(compgen -W "${comp_ssh_hosts}" -- $cur))
        return 0
}


complete -F _complete_ssh_hosts ssh

 

Вт, 13 сентября 2016, 11:17

chroot ssh linux user

/etc/ssh/sshd_config: 

 

#Subsystem sftp /usr/lib/openssh/sftp-server

Subsystem sftp internal-sftp

 

Match group chrooted

    ChrootDirectory /www/sites

    X11Forwarding no

    AllowTcpForwarding no

    ForceCommand internal-sftp

 

/etc/passwd:

testuser:x:1002:1002::/www/sites/testuser:/usr/lib/sftp-server