SSH, les séquences d'échappement

Cela peut par exemple vous servir pour gérer ou retrouver vos tunnel.

Extrait du man :

 ESCAPE CHARACTERS
     When a pseudo-terminal has been requested, ssh supports a number of func-
     tions through the use of an escape character.

     A single tilde character can be sent as ~~ or by following the tilde by a
     character other than those described below.  The escape character must
     always follow a newline to be interpreted as special.  The escape charac-
     ter can be changed in configuration files using the EscapeChar configura-
     tion directive or on the command line by the -e option.

     The supported escapes (assuming the default `~') are:

     ~.      Disconnect.

     ~^Z     Background ssh.

     ~#      List forwarded connections.

     ~&      Background ssh at logout when waiting for forwarded connection /
             X11 sessions to terminate.

     ~?      Display a list of escape characters.

     ~B      Send a BREAK to the remote system (only useful for SSH protocol
             version 2 and if the peer supports it).

     ~C      Open command line.  Currently this allows the addition of port
             forwardings using the -L, -R and -D options (see above).  It also
             allows the cancellation of existing port-forwardings with
             -KL[<em>bind_address</em>:]<em>port</em> for local, -KR[<em>bind_address</em>:]<em>port</em> for re-
             mote and -KD[<em>bind_address</em>:]<em>port</em> for dynamic port-forwardings.
             !<em>command</em> allows the user to execute a local command if the
             PermitLocalCommand option is enabled in <a href="http://man.openbsd.org/">ssh_config(5)</a>.  Basic
             help is available, using the -h option.

     ~R      Request rekeying of the connection (only useful for SSH protocol
             version 2 and if the peer supports it).
rtfm  ssh 

Mettre à l'heure une machine distant en ssh

Pour mettre a l’heure une machine distante avec la date et heure du système local, utiliser ssh comme ci dessous.

Les options de date permette d’envoyer la date et l’heure au bon format au système distant.

ssh 1.2.3.4 date \`date +'%m%d%H%M%y'\`

Sinon, il y a ntpd :)

date  ssh 

Export display vers Windows avec Xming

Xming

Xming peut être utilisé de plusieurs manières

  • En mode XDMCP pour accéder à l’écran de login de votre machine.
  • En mode SSH pour lancer directement les applications graphiques souhaitées

Il faut dans un premier temps, installer le serveur X sur votre windows http://sourceforge.net/project/showfiles.php?group_id=156984 et récupérer les programmes :

  • Xming
  • Xming-mesa (en cas ou l’openGL n’est pas supporté par votre carte graphique)
  • Xming-fonts
  • Xming-tools-and-client

SSHd

Activer l’export de X11

Commencez par paramétrer votre Linux favori, et principalement sshd_config qui se trouve dans /etc/ssh/sshd_config et modifier ou ajouter les ligne suivantes ou laisser la configuration actuel qui est moins sécurisé.

[Lire]

Utilisation de tunnel SSH

Le port forwarding SSH permet, par exemple, de se connecter à un intranet depuis l’extérieur. Supposons que vous ayez accès à un compte sur une machine d’un réseau distant et que celle-ci soit visible de l’extérieur et accessible en SSH. Si cette machine peut atteindre le réseau interne de la société, nous le pouvons aussi depuis notre machine distante :

ssh -L 8081:127.0.0.1:80 -X -C user

Il suffit ensuite de demander, sur notre navigateur local, l’adresse http://localhost:8081 pour, en fait, accéder à la machine intranet sur le port 80. Les paquets sont donc transmis, de manière transparente, depuis le serveur SSH, sur une machine choisie et un port déterminé.

[Lire]