<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.thebuble.org/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Bubble Sweat Bubble - Tag - ssh</title>
  <link>http://blog.thebuble.org/</link>
  <atom:link href="http://blog.thebuble.org/feed/tag/ssh/rss2" rel="self" type="application/rss+xml"/>
  <description>Les périgrinations d'un mec normal dans un monde qui ne l'est franchement pas</description>
  <language>fr</language>
  <pubDate>Thu, 02 Feb 2012 14:57:13 +0100</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Emacs : accéder à des fichiers distants avec TRAMP</title>
    <link>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-acc%C3%A9der-%C3%A0-des-fichiers-distants-avec-TRAMP</link>
    <guid isPermaLink="false">urn:md5:f416d467dc392710066aa0617043fafc</guid>
    <pubDate>Tue, 22 Dec 2009 14:53:00 +0100</pubDate>
    <dc:creator>Olivier</dc:creator>
        <category>emacs</category>
        <category>emacs</category><category>ssh</category><category>tramp</category>    
    <description>    &lt;h2&gt;TRAMP c'est quoi&amp;nbsp;?&lt;/h2&gt;


&lt;p&gt;&lt;a href=&quot;http://www.gnu.org/software/tramp/&quot; hreflang=&quot;en&quot;&gt;TRAMP&lt;/a&gt; (Transparent Remote (file) Access, Multiple Protocol) est une extension pour &lt;a href=&quot;http://www.emacs.org&quot; hreflang=&quot;en&quot;&gt;Emacs&lt;/a&gt; permettant d'accéder à des machines distantes comme si leurs ressources étaient disponibles en local. De façon générale, cela permet d'ouvrir des fichiers distants, de naviguer dans l'arborescence des fichiers avec dired, d'exécuter des commandes shells, ... Les plus habitués à &lt;a href=&quot;http://www.emacs.org&quot; hreflang=&quot;en&quot;&gt;Emacs&lt;/a&gt; auront de suite compris l'intérêt&amp;nbsp;: toutes ses possibilités sont donc accessibles sur les machines distantes&amp;nbsp;! Pour cela, il suffit de pouvoir s'y connecter via rsh, rlogin, telnet, ssh ou toute autre méthode de connexion similaire (par exemple sudo). Le transfert de fichiers sera effectué au choix parmi les commandes rcp, rsync, scp ou pscp (sous Windows).&lt;/p&gt;


&lt;p&gt;TRAMP est livré avec &lt;a href=&quot;http://www.emacs.org&quot; hreflang=&quot;en&quot;&gt;Emacs&lt;/a&gt; depuis la version 22. Pour les versions précédentes, il suffit de le télécharger ici&amp;nbsp;: &lt;a href=&quot;ftp://ftp.gnu.org/gnu/tramp/&quot; hreflang=&quot;en&quot;&gt;ftp://ftp.gnu.org/gnu/tramp/&lt;/a&gt;.&lt;/p&gt;


&lt;h3&gt;Configuration générale&lt;/h3&gt;

&lt;h4&gt;Syntaxe TRAMP&lt;/h4&gt;

&lt;p&gt;La syntaxe par défaut pour accéder à un fichier distant est &lt;em&gt;/machine:localname&lt;/em&gt;. Personnellement je trouve que cette syntaxe manque de clarté et puis je suis habitué à la norme URL/URI. J'ai donc activé la syntaxe URL de TRAMP ce qui donne ceci&amp;nbsp;: &lt;em&gt;/protocol://machine&lt;a href=&quot;http://blog.thebuble.org/post/2009/12/22/:port&quot; title=&quot;:port&quot;&gt;:port&lt;/a&gt;/localname&lt;/em&gt;. Voici les commandes à rajouter dans votre &lt;em&gt;.emacs&lt;/em&gt; afin d'activer cette fonction&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; use /protocol://host[:port]/path/to/file&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;syntax 'url&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;require 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Backups&lt;/h4&gt;

&lt;p&gt;À moins d'avoir une bonne connexion à Internet, il est souvent préférable d'enregistrer les fichiers temporaires et les backups des fichiers distants localement&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; turn off backup-directory-alist for tramp&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'backup&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;directory&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;cons&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;name&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;regexp &lt;span style=&quot;color: #b1b100;&quot;&gt;nil&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; set a dedicated auto-save directory&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;auto&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;save&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;directory &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;~/.emacs.d/tramp-autosave&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Protocoles par défaut&lt;/h4&gt;

&lt;p&gt;On peut configurer le protocole à utiliser (si non spécifié) en général ou par machine. Par exemple, pour qu'emacs utilise SSH par défaut pour toutes les machines sauf pour root@localhost, cas dans lequel il doit utiliser sudo&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; default method to SSH&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;method &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ssh&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; use sudo for root@localhost&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;method&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               '&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`localhost&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`root&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;sudo&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Rebonds&lt;/h4&gt;

&lt;p&gt;Une fonctionnalité très pratique de TRAMP est sa gestion des rebonds. Par exemple si vous ne pouvez accéder à la machine web1 qu'en passant par example.com, il suffit de rajouter ceci à la configuration &lt;em&gt;.emacs&lt;/em&gt;&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; when web[0-9] is requested, connect to example.com first&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;proxies&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               '&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`web[0-9]&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;nil&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/ssh://example.com&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
               &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Ainsi, lorsqu'emacs devra se connecter à web1, il ouvrira d'abord une connection ssh à example.com puis sur cette machine lancera une nouvelle connection ssh à web1. Cette fonctionnalité permet donc d'accéder à n'importe quelle machine à laquelle vous avez accès, quelque que soit le nombre de rebonds nécessaires.&lt;/p&gt;


&lt;h4&gt;Exemple de configuration&lt;/h4&gt;

&lt;p&gt;Un bon exemple vaut mieux qu'un long discours, voici donc ma configuration TRAMP&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; use /[protocol:]//host[:port]/path/to/file&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;syntax 'url&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;require 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; enable partial completion mode&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;partial&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;completion&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;mode &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; turn off backup-directory-alist for tramp&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'backup&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;directory&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;cons&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;name&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;regexp &lt;span style=&quot;color: #b1b100;&quot;&gt;nil&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; set a dedicated auto-save directory&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;auto&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;save&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;directory &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;~/.emacs.d/tramp-autosave&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; default method to SSH&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;method &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ssh&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; use sudo for root@localhost&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;method&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               '&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`localhost&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`root&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;sudo&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; set the prompt pattern&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;shell&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;prompt&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;pattern &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;[^&amp;gt;$#]?[&amp;gt;$#] *&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; shell&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;prompt&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;pattern &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;[^&amp;gt;$#]?[&amp;gt;$#] *&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; make sure terminal is defined to dumb&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;terminal&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;type &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;dumb&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; when web[0-9] is requested, connect to example.com first&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;proxies&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               '&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`web[0-9]&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;nil&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/ssh://example.com&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
               &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;h3&gt;Utilisation avancée&lt;/h3&gt;

&lt;p&gt;Éditer des fichiers distants est bien pratique mais il y a encore mieux&amp;nbsp;: naviguer dans les dossiers via &lt;em&gt;dired&lt;/em&gt;, exécuter des shells distants via &lt;em&gt;shell', des terminaux distants via &lt;/em&gt;term'', bref tout ce que votre emacs vous permet. Pour cela, rien de plus facile&amp;nbsp;: il suffit que le répertoire courant soit sur la machine distante pour que toutes les commandes shells soient exécutées sur cette machine.&lt;/p&gt;


&lt;p&gt;Par exemple, si vous ouvrez le dossier /mon/dossier sur la machine example.com via &lt;em&gt;/ssh://example.com/mon/dossier&lt;/em&gt;, toutes les commandes exécutées depuis ce buffer auront lieu sur example.com dans le dossier /mon/dossier. Voici les commandes les plus pratiques&amp;nbsp;:&lt;/p&gt;

&lt;pre&gt;* M-x shell =&amp;gt; ouvre un shell simple
* M-x term =&amp;gt; ouvre un terminal complet
* M-! =&amp;gt; exécute n'importe quelle commande shell&lt;/pre&gt;


&lt;p&gt;Il est donc très facile de créer des macros à lancer sur des machines distantes pour réaliser des commandes répétitives. Grâce à la puissance de TRAMP et la souplesse d'Emacs et de ses macros, on peut donc réaliser tout un jeu de commandes pour réaliser toutes les tâches répétitives quelque soit la machine concernée. La seule limite étant d'y avoir accès&amp;nbsp;!&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-acc%C3%A9der-%C3%A0-des-fichiers-distants-avec-TRAMP#comment-form</comments>
      <wfw:comment>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-acc%C3%A9der-%C3%A0-des-fichiers-distants-avec-TRAMP#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.thebuble.org/feed/atom/comments/35</wfw:commentRss>
      </item>
    
</channel>
</rss>
