Asustor Problème Clé SSH (Server refused our key)

Drthrax74

Chevalier Jedi
1 Janvier 2021
468
107
83
Bonjour,

Je rencontres actuellement un problème pour mettre en place l'authentification SSH sur mon NAS. (Compte Root)

Bash:
# Déclarer ma Clé SSH pour le compte Root !
SSH_KEY=""

# Création du dossier SSH:
mkdir -p ~/.ssh;

# Déclarer la Clé SSH:
echo "$SSH_KEY" > ~/.ssh/authorized_keys;

# Permission Dossier:
chmod 700 /root/.ssh;

# Permission Fichier
chmod 600 /root/.ssh/authorized_keys;

# Relancer du service SSH ???
/etc/init.d/S41ssh restart

S41ssh:
Bash:
#!/bin/sh
#
# Start the ssh....
#

#Deprecated option
OPTIONS="UsePrivilegeSeparation KeyRegenerationInterval ServerKeyBits RSAAuthentication "
OPTIONS="$OPTIONS RhostsRSAAuthentication Ciphers MACs"

case "$1" in
  start)
        echo "Starting ssh..."
        [ "xbooting" = "x$2" ] && /usr/bin/confutil -set /var/log/bootup.log service progress sshd
        [ "xbooting" = "x$2" ] && /usr/bin/confutil -set /var/log/bootup.log phase progress service
        [ -s /usr/etc/ssh/ssh_host_key ] && [ -s /usr/etc/ssh/ssh_host_key.pub ] || rm -f /usr/etc/ssh/ssh_host_key* > /dev/null 2>&1
        [ -s /usr/etc/ssh/ssh_host_dsa_key ] && [ -s /usr/etc/ssh/ssh_host_dsa_key.pub ] || rm -f /usr/etc/ssh/ssh_host_dsa_key* > /dev/null 2>&1
        [ -s /usr/etc/ssh/ssh_host_rsa_key ] && [ -s /usr/etc/ssh/ssh_host_rsa_key.pub ] || rm -f /usr/etc/ssh/ssh_host_rsa_key* > /dev/null 2>&1
        [ -s /usr/etc/ssh/ssh_host_ecdsa_key ] && [ -s /usr/etc/ssh/ssh_host_ecdsa_key.pub ] || rm -f /usr/etc/ssh/ssh_host_ecdsa_key* > /dev/null 2>&1
        [ ! -f /usr/etc/ssh/ssh_host_key ] && ssh-keygen -t rsa1 -f /usr/etc/ssh/ssh_host_key -N "" > /dev/null 2>&1
        [ ! -f /usr/etc/ssh/ssh_host_dsa_key ] && ssh-keygen -t dsa -f /usr/etc/ssh/ssh_host_dsa_key -N "" > /dev/null 2>&1
        [ ! -f /usr/etc/ssh/ssh_host_rsa_key ] && ssh-keygen -t rsa -f /usr/etc/ssh/ssh_host_rsa_key -N "" > /dev/null 2>&1
        [ ! -f /usr/etc/ssh/ssh_host_ecdsa_key ] && ssh-keygen -t ecdsa -f /usr/etc/ssh/ssh_host_ecdsa_key -N "" > /dev/null 2>&1
        IsEnabled=`/usr/bin/confutil -get /etc/nas.conf Sshd IsEnabled | /usr/bin/tr [:lower:] [:upper:]`
        for OPTION_KEY in  $OPTIONS
        do
                 sed -e "s/^$OPTION_KEY/#$OPTION_KEY/g"  -i /usr/etc/ssh/sshd_config
        done

        [ "xNO" != "x$IsEnabled" ] && /usr/sbin/sshd
        ;;
  stop)
        echo "Stopping ssh..."
        sshd_pid=`cat /var/run/sshd.pid`
        kill `pstree -p $sshd_pid| grep -Eo 'sshd\([0-9]+\)'|grep -Eo '[0-9]+'`
        ;;
  restart|reload)
        "$0" stop
        "$0" start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $?


Le script S41ssh semble buggué quand on fait un reload:
Code:
S41ssh: line 37: S41ssh: not found
S41ssh: line 38: S41ssh: not found
 
Dernière édition: