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

31 lines
940 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/sh
SYSCONFIGPATH=/etc/sshconnect.cfg
CONFIGPATH=~/.config/sshconnect.cfg
if ! [ -e $CONFIGPATH ]; then
if ! [ -e $SYSCONFIGPATH ]; 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
cp $SYSCONFIGPATH $CONFIGPATH
fi
fi
. $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
echo "ssh -p $PORT -N -f -L 6000:localhost:6000 $SSHUSER@$SERVER"
ssh -p $PORT -N -f -L 6000:localhost:6000 $SSHUSER@$SERVER