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 myuser@server.com 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.