shell-scripte-code/shellinabox_sshwrapper.sh
2017-05-16 18:08:15 +02:00

27 lines
787 B
Bash
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 
read -p "SSH remote host (hostname or ip address): " host;
#
read -p "If a puplic_key authentification?: N or y: " puplic;
#
read -p "SSH remote port (22): " port;
#
read -p "SSH remote username: " username;
#
if [ "$puplic" == "y" ];
then
read -p "How is your public_key?: " key;
echo $key > ~/.ssh/id_rsa.pub;
rm ~/.ssh/id_rsa;
echo "Enter your private id here and press the enter key for a new line !!!";
id=null
while [ "$id" != "" ];
do
read -p "How is your id_rsa key?: " id;
echo $id >> ~/.ssh/id_rsa;
done
exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $port $username@$host;
else
exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $port $username@$host;
fi