Pejman Moghadam / Slackware

Slackware 13.1 - Sharing Screen sessions in Linux classrooms

Public domain


SetUID for screen binary

chmod u+s $(readlink -f $(which screen))

Add a restricted user

[ ! -e /bin/rbash ] && ln -sf bash /bin/rbash
useradd -m -s /bin/rbash students
passwd students

/home/students/.profile

trap "" 2 3 20
clear
echo "Welcome to the Linux Class"
echo "You can enter <Ctrl-a d> to detach at any time or just close your terminal"
echo -n "Press Enter to continue..." && read
screen -x root/linux-class
exit

/home/students/.bash_profile

    source ~/.profile

/root/linux-class.sh

#!/bin/bash
source /etc/profile
screen -wipe
if ! ls /root/.screen/*linux-class* &> /dev/null; then
  screen -dmS linux-class
fi
TMP=$(mktemp)
cat > ${TMP} << EOF
multiuser on
acladd students
aclchg students -wx "#,?"
aclchg students +x "detach"
EOF
screen -r linux-class -X source ${TMP}
rm ${TMP}

Start and attach to linux-class session

/root/linux-class.sh
screen -x linux-class

remote access to linux-class session

ssh students@hostname

BY: Pejman Moghadam
TAG: screen, trap, suid, rbash
DATE: 2011-12-10 10:06:56


Pejman Moghadam / Slackware [ TXT ]