You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sshthinclient.sh 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. clear
  3. trap 'exit 1' 2 20
  4. echo "Hello, and welcome to the SSH ThinClient."
  5. echo "(script written by @ColtonDRG for @dvdmuckle's project)"
  6. echo
  7. echo "For your own security and safety, please log out of your session when you're done"
  8. echo "If you don't know how to log out, you shouldn't be using this computer."
  9. echo
  10. echo "If you screw up during the login process, you can start over with Ctrl+C"
  11. echo
  12. echo
  13. echo "What's the hostname, IP, or domain you want to connect to?"
  14. # Comment the following line to hide the alternate port instruction
  15. echo "(you can add a port like example.com:2222, port 22 is used if none is specified)"
  16. # Comment the following line to hide the local administration menu access instruction
  17. echo "(use 127.0.0.1 to access a local administration shell)"
  18. read -e -p "Connect to: " read_ssh_sshd
  19. if [ "$read_ssh_sshd" = "" ]; then
  20. echo "You must enter a hostname!"
  21. exit 1
  22. fi
  23. if [ "$read_ssh_sshd" = "127.0.0.1" ]; then
  24. echo
  25. echo "Enter admin password to access local administration shell."
  26. su - sshadmin
  27. exit 0
  28. fi
  29. SSH_HOSTNAME=$(echo "$read_ssh_sshd" | sed 's/:.*//')
  30. SSH_PORT=$(echo "$read_ssh_sshd" | sed 's/.*://')
  31. if [ "$SSH_PORT" = "$SSH_HOSTNAME" ]; then
  32. SSH_PORT="22"
  33. fi
  34. echo "What's your username on the remote machine?"
  35. read -e -p "Username: " read_ssh_user
  36. if [ "$read_ssh_user" = "" ]; then
  37. echo "You must enter a username!"
  38. exit 1
  39. fi
  40. SSH_USER="$read_ssh_user"
  41. echo "That's all we need! You'll be prompted for your password by the remote host."
  42. echo
  43. echo "To recap..."
  44. echo "The server is $SSH_HOSTNAME."
  45. echo "The port is $SSH_PORT."
  46. echo "Your username is $SSH_USER."
  47. echo
  48. echo "Connecting..."
  49. ssh -l $SSH_USER -p $SSH_PORT $SSH_HOSTNAME
  50. exit 0