shell-scripte-code/shellinabox_sshwrapper.sh

28 lines
791 B
Bash
Raw Normal View History

2019-01-07 20:23:02 +01:00
#!/usr/bin/env bash
2018-11-11 04:24:37 +01:00
#
2016-12-15 14:37:59 +01:00
read -p "SSH remote host (hostname or ip address): " host;
#
read -p "If a puplic_key authentification?: N or y: " puplic;
#
2016-12-15 15:38:19 +01:00
read -p "SSH remote port (22): " port;
2016-12-15 14:37:59 +01:00
#
read -p "SSH remote username: " username;
#
if [ "$puplic" == "y" ];
2018-11-11 04:24:37 +01:00
then
2016-12-26 17:43:05 +01:00
read -p "How is your public_key?: " key;
echo $key > ~/.ssh/id_rsa.pub;
rm ~/.ssh/id_rsa;
2017-05-16 18:08:15 +02:00
echo "Enter your private id here and press the enter key for a new line !!!";
id=null
while [ "$id" != "" ];
2018-11-11 04:24:37 +01:00
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;
2018-11-11 04:24:37 +01:00
else
exec ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $port $username@$host;
fi