Update lastlog even on non interactive ssh (eg. with rsync)

This commit is contained in:
Victor LABORIE 2017-08-22 18:15:14 +02:00
parent 985c72194a
commit 9606b23d97
2 changed files with 6 additions and 1 deletions

5
bkctld
View file

@ -157,9 +157,11 @@ mk_jail() {
passwd="${TPLDIR}/passwd"
shadow="${TPLDIR}/shadow"
group="${TPLDIR}/group"
sshrc="${TPLDIR}/sshrc"
[ -f "${LOCALTPLDIR}/passwd" ] && passwd="${LOCALTPLDIR}/passwd"
[ -f "${LOCALTPLDIR}/shadow" ] && shadow="${LOCALTPLDIR}/shadow"
[ -f "${LOCALTPLDIR}/group" ] && group="${LOCALTPLDIR}/group"
[ -f "${LOCALTPLDIR}/sshrc" ] && group="${LOCALTPLDIR}/sshrc"
umask 077
echo "1 - Creating the chroot"
@ -181,12 +183,13 @@ mk_jail() {
cp "$passwd" etc
cp "$shadow" etc
cp "$group" etc
cp "$sshrc" etc/ssh
echo "3 - Copying binaries"
cp -f /lib/ld-linux.so.2 lib 2>/dev/null || cp -f /lib64/ld-linux-x86-64.so.2 lib64
cp /lib/x86_64-linux-gnu/libnss* lib/x86_64-linux-gnu
for dbin in /bin/sh /bin/ls /bin/mkdir /bin/cat /bin/rm /bin/sed /usr/bin/rsync /usr/sbin/sshd /usr/lib/openssh/sftp-server; do
for dbin in /bin/sh /bin/ls /bin/mkdir /bin/cat /bin/rm /bin/sed /usr/bin/rsync /usr/bin/lastlog /usr/sbin/sshd /usr/lib/openssh/sftp-server; do
cp -f $dbin ${JAILDIR}/${jail}/$dbin;
for lib in $(ldd $dbin | grep -Eo "/.*so.[0-9\.]+"); do
cp -p $lib ${JAILDIR}/${jail}/$lib

2
tpl/sshrc Normal file
View file

@ -0,0 +1,2 @@
#!/bin/sh
/usr/bin/lastlog -Su root