Le mardi 11 août 2009 à 11:05 +0200, Bernd 'Siggy' Brentrup a écrit :
> Hi,
>
> when looking into this bug I noticed you mention a bogus test:
>
> permitrootlogin=`cat ${I}/sshd_config | grep "PermitRootLogin" | grep -v "#"`
>
> Try the following:
> % grep "PermitRootLogin" | grep -v '#' <<EOF
> PermitRootLogin no
> # PermitRootLogin yes
> PermitRootLogin yes # Allow root to login remotely
> EOF
> PermitRootLogin no
> %
>
> IIRC sshd uses the last occurrence of an option if it is given
> multiple times.
>
> I'd suggest you change your test to
> % (cut -d'#' -f 1 | grep PermitRootLogin) <<EOF
> PermitRootLogin no
> # PermitRootLogin yes
> PermitRootLogin yes # Allow root to login remotely
> EOF
> PermitRootLogin no
> PermitRootLogin yes
> %
>
You are right, and this was already fixed in the latest release.
The code is now:
grep -i '^PermitRootLogin[ =]' ${SSH_CONFIG_FILE} | tail -1
Which detects the last option only.
Cheers,
Julien
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]