New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
A Shell for SSH Tunnellers Only
sleddog@home:~$ grep myuser/etc/passwd myuser:x:1001:1001::/home/myuser:/bin/exitonly.sh
sleddog@home:~$ cat /bin/exitonly.sh
#!/bin/bash
HELPMSG='Type "exit" and press enter to close the connection.'
HOSTNAME=`hostname`
PROMPT="${LOGNAME}@${HOSTNAME}:~$ "
# Debian 7: touch ~/.hushlogin and create ~/motd to have per-user
# motd messages.
if [[ -e "${HOME}/.hushlogin" && -e "${HOME}/motd" ]]; then
cat ${HOME}/motd
fi
echo
echo "Connection established."
echo $HELPMSG
echo
COMMAND=' '
while [ "${COMMAND:0:4}" != "exit" ]; do
echo -n "$PROMPT"
read COMMAND
if [ -z "$COMMAND" ]; then
continue
elif [ "${COMMAND:0:4}" != "exit" ]; then
echo $HELPMSG
fi
done
exit 0
Example...
sleddog@home:~$ ssh -p 22 -D 9999 -i /home/sleddog/.ssh/myuser-key [email protected] Creating connection... .-. .-._ _.../ `, _.-. | `'-' \ \_'` | \ '.__,/ `\_.--, / '._/ | / '. / ; _ _'--; '--|- (_) __ (_) -|--' Hello Kitty.--|- (__) -|--. .-\- -/-. ' '. .' ` '-._ _.-' `""--....--""` Connection established. Type "exit" and press enter to close the connection. myuser@server:~$ ls Type "exit" and press enter to close the connection. myuser@server:~$ rm * -rf Type "exit" and press enter to close the connection. myuser@server:~$ what do I do next? Type "exit" and press enter to close the connection. myuser@server:~$ exit Connection to server.com closed.


Comments
I use /bin/false with -N
I wanted something friendly, interactive & safe for the user who doesn't know what a Linux command line prompt is
Thanks sleddog! This is really useful for the guys at work
Ha! How to piss off your coworkers...
@sleddog Connect + generate input lines until one core reaches 100% utilization + ??? = PROFIT