1
0
This repository has been archived on 2023-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
dtux__lalis-assistance/SOURCES/sshconnect

27 lines
852 B
Plaintext
Raw Normal View History

#!/usr/bin/sh
CONFIGPATH=~/.config/sshconnect.cfg
if ! [ -f $CONFIGPATH ]; then
echo "Saississez les données de connexion au serveur"
read -p "Nom d'utilisateur : " SSHUSER
read -p "Serveur : " SERVER
read -p "Port ssh : " PORT
echo -e "SSHUSER=$SSHUSER\nSERVER=$SERVER\nPORT=$PORT" >$CONFIGPATH
else
. $CONFIGPATH
if [ -z "$SSHUSER" ]; then
read -p "Nom d'utilisateur : " SSHUSER
echo -e "SSHUSER=$SSHUSER\n" >>$CONFIGPATH
fi
if [ -z "$SERVER" ]; then
read -p "Serveur : " SERVER
echo -e "SERVER=$SERVER\n" >>$CONFIGPATH
fi
if [ -z "$PORT" ]; then
read -p "Nom d'utilisateur : " PORT
echo -e "PORT=$PORT\n" >>$CONFIGPATH
fi
fi
echo "ssh -p $PORT -N -f -L 6000:localhost:6000 $SSHUSER@$SERVER"
ssh -p $PORT -N -f -L 6000:localhost:6000 $SSHUSER@$SERVER