summaryrefslogtreecommitdiff
path: root/doc/misc/tramp.texi
blob: 0d751a93b1d8c072d5629905bc7850e14418451e (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
\input texinfo   @c -*-texinfo-*-
@setfilename ../../info/tramp
@c %**start of header
@settitle TRAMP User Manual
@setchapternewpage odd
@c %**end of header

@c This is *so* much nicer :)
@footnotestyle end

@c In the Tramp CVS, the version number is auto-frobbed from
@c configure.ac, so you should edit that file and run
@c "autoconf && ./configure" to change the version number.

@c Additionally, flags are set with respect to the Emacs flavor; and
@c depending whether Tramp is packaged into (X)Emacs, or standalone.

@include trampver.texi

@c Macro for formatting a filename according to the repective syntax.
@c xxx and yyy are auxiliary macros in order to omit leading and
@c trailing whitespace.  Not very elegant, but I don't know it better.

@macro xxx {one}@c
@set \one\@c
@end macro

@macro yyy {one, two}@c
@xxx{x\one\}@c
@ifclear x@c
\one\@w{}\two\@c
@end ifclear
@clear x\one\@c
@end macro

@macro trampfn {method, user, host, localname}@c
@value{prefix}@yyy{\method\,@value{postfixhop}}@yyy{\user\,@@}\host\@value{postfix}\localname\@c
@end macro

@copying
Copyright @copyright{} 1999, 2000, 2001, 2002, 2003, 2004, 2005,
  2006, 2007, 2008 Free Software Foundation, Inc.

@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
and with the Back-Cover Texts as in (a) below.  A copy of the license
is included in the section entitled ``GNU Free Documentation License''.

(a) The FSF's Back-Cover Text is: ``You have the freedom to
copy and modify this GNU manual.  Buying copies from the FSF
supports it in developing GNU and promoting software freedom.''
@end quotation
@end copying

@c Entries for @command{install-info} to use
@dircategory @value{emacsname}
@direntry
* TRAMP: (tramp).                Transparent Remote Access, Multiple Protocol
                                 @value{emacsname} remote file access via rsh and rcp.
@end direntry

@tex

@titlepage
@title @value{tramp} version @value{trampver} User Manual

@author by Daniel Pittman
@author based on documentation by Kai Gro@ss{}johann

@page
@insertcopying

@end titlepage
@page

@end tex

@ifnottex
@node Top, Overview, (dir), (dir)
@top @value{tramp} version @value{trampver} User Manual

This file documents @value{tramp} version @value{trampver}, a remote file
editing package for @value{emacsname}.

@value{tramp} stands for `Transparent Remote (file) Access, Multiple
Protocol'.  This package provides remote file editing, similar to
@value{ftppackagename}.

The difference is that @value{ftppackagename} uses FTP to transfer
files between the local and the remote host, whereas @value{tramp} uses a
combination of @command{rsh} and @command{rcp} or other work-alike
programs, such as @command{ssh}/@command{scp}.

You can find the latest version of this document on the web at
@uref{http://www.gnu.org/software/tramp/}.

@c Pointer to the other Emacs flavor is necessary only in case of
@c standalone installation.
@ifset installchapter
The manual has been generated for @value{emacsname}.
@ifinfo
If you want to read the info pages for @value{emacsothername}, you
should read in @ref{Installation} how to create them.
@end ifinfo
@ifhtml
If you're using the other Emacs flavor, you should read the
@uref{@value{emacsotherfilename}, @value{emacsothername}} pages.
@end ifhtml
@end ifset

@ifhtml
@ifset jamanual
This manual is also available as a @uref{@value{japanesemanual},
Japanese translation}.
@end ifset

The latest release of @value{tramp} is available for
@uref{ftp://ftp.gnu.org/gnu/tramp/, download}, or you may see
@ref{Obtaining Tramp} for more details, including the CVS server
details.

@value{tramp} also has a @uref{http://savannah.gnu.org/projects/tramp/,
Savannah Project Page}.
@end ifhtml

There is a mailing list for @value{tramp}, available at
@email{tramp-devel@@gnu.org}, and archived at
@uref{http://lists.gnu.org/archive/html/tramp-devel/, the
@value{tramp} Mail Archive}.
@ifhtml
Older archives are located at
@uref{http://sourceforge.net/mailarchive/forum.php?forum=tramp-devel,
SourceForge Mail Archive} and
@uref{http://www.mail-archive.com/emacs-rcp@@ls6.cs.uni-dortmund.de/,
The Mail Archive}.
@c in HTML output, there's no new paragraph.
@*@*
@end ifhtml

@insertcopying

@end ifnottex

@menu
* Overview::                    What @value{tramp} can and cannot do.

For the end user:

* Obtaining Tramp::             How to obtain @value{tramp}.
* History::                     History of @value{tramp}.
@ifset installchapter
* Installation::                Installing @value{tramp} with your @value{emacsname}.
@end ifset
* Configuration::               Configuring @value{tramp} for use.
* Usage::                       An overview of the operation of @value{tramp}.
* Bug Reports::                 Reporting Bugs and Problems.
* Frequently Asked Questions::  Questions and answers from the mailing list.
* Function Index::              @value{tramp} functions.
* Variable Index::              User options and variables.
* Concept Index::               An item for each concept.

For the developer:

* Version Control::             The inner workings of remote version control.
* Files directories and localnames::  How file names, directories and localnames are mangled and managed.
* Traces and Profiles::         How to Customize Traces.
* Issues::                      Debatable Issues and What Was Decided.

* GNU Free Documentation License:: The license for this documentation.

@detailmenu
 --- The Detailed Node Listing ---
@c
@ifset installchapter
Installing @value{tramp} with your @value{emacsname}

* Installation parameters::     Parameters in order to control installation.
* Load paths::                  How to plug-in @value{tramp} into your environment.
* Japanese manual::             Japanese manual.

@end ifset

Configuring @value{tramp} for use

* Connection types::            Types of connections made to remote machines.
* Inline methods::              Inline methods.
* External transfer methods::   External transfer methods.
@ifset emacsgw
* Gateway methods::             Gateway methods.
@end ifset
* Default Method::              Selecting a default method.
* Default User::                Selecting a default user.
* Default Host::                Selecting a default host.
* Multi-hops::                  Connecting to a remote host using multiple hops.
* Customizing Methods::         Using Non-Standard Methods.
* Customizing Completion::      Selecting config files for user/host name completion.
* Password handling::           Reusing passwords for several connections.
* Connection caching::          Reusing connection related information.
* Remote Programs::             How @value{tramp} finds and uses programs on the remote machine.
* Remote shell setup::          Remote shell setup hints.
* Windows setup hints::         Issues with Cygwin ssh.
* Auto-save and Backup::        Auto-save and Backup.

Using @value{tramp}

* Filename Syntax::             @value{tramp} filename conventions.
* Alternative Syntax::          URL-like filename syntax.
* Filename completion::         Filename completion.
* Remote processes::            Integration with other @value{emacsname} packages.
* Cleanup remote connections::  Cleanup remote connections.

The inner workings of remote version control

* Version Controlled Files::    Determining if a file is under version control.
* Remote Commands::             Executing the version control commands on the remote machine.
* Changed workfiles::           Detecting if the working file has changed.
* Checking out files::          Bringing the workfile out of the repository.
* Miscellaneous Version Control::  Things related to Version Control that don't fit elsewhere.

Things related to Version Control that don't fit elsewhere

* Remote File Ownership::       How VC determines who owns a workfile.
* Back-end Versions::           How VC determines what release your RCS is.

How file names, directories and localnames are mangled and managed

* Localname deconstruction::    Breaking a localname into its components.
@ifset emacs
* External packages::           Integration with external Lisp packages.
@end ifset

@end detailmenu
@end menu

@node Overview
@chapter An overview of @value{tramp}
@cindex overview

After the installation of @value{tramp} into your @value{emacsname}, you
will be able to access files on remote machines as though they were
local.  Access to the remote file system for editing files, version
control, and @code{dired} are transparently enabled.

Your access to the remote machine can be with the @command{rsh},
@command{rlogin}, @command{telnet} programs or with any similar
connection method.  This connection must pass @acronym{ASCII}
successfully to be usable but need not be 8-bit clean.

The package provides support for @command{ssh} connections out of the
box, one of the more common uses of the package.  This allows
relatively secure access to machines, especially if @command{ftp}
access is disabled.

Under Windows, @value{tramp} is integrated with the PuTTY package,
using the @command{plink} program.

The majority of activity carried out by @value{tramp} requires only that
the remote login is possible and is carried out at the terminal.  In
order to access remote files @value{tramp} needs to transfer their content
to the local machine temporarily.

@value{tramp} can transfer files between the machines in a variety of ways.
The details are easy to select, depending on your needs and the
machines in question.

The fastest transfer methods for large files rely on a remote file
transfer package such as @command{rcp}, @command{scp}, @command{rsync}
or (under Windows) @command{pscp}.

If the remote copy methods are not suitable for you, @value{tramp} also
supports the use of encoded transfers directly through the shell.
This requires that the @command{mimencode} or @command{uuencode} tools
are available on the remote machine.  These methods are generally
faster for small files.

@value{tramp} is still under active development and any problems you encounter,
trivial or major, should be reported to the @value{tramp} developers.
@xref{Bug Reports}.


@subsubheading Behind the scenes
@cindex behind the scenes
@cindex details of operation
@cindex how it works

This section tries to explain what goes on behind the scenes when you
access a remote file through @value{tramp}.

Suppose you type @kbd{C-x C-f} and enter part of an @value{tramp} file name,
then hit @kbd{@key{TAB}} for completion.  Suppose further that this is
the first time that @value{tramp} is invoked for the host in question.  Here's
what happens:

@itemize
@item
@value{tramp} discovers that it needs a connection to the host.  So it
invokes @samp{telnet @var{host}} or @samp{rsh @var{host} -l
@var{user}} or a similar tool to connect to the remote host.
Communication with this process happens through an
@value{emacsname} buffer, that is, the output from the remote end
goes into a buffer.

@item
The remote host may prompt for a login name (for @command{telnet}).
The login name is given in the file name, so @value{tramp} sends the
login name and a newline.

@item
The remote host may prompt for a password or pass phrase (for
@command{rsh} or for @command{telnet} after sending the login name).
@value{tramp} displays the prompt in the minibuffer, asking you for the
password or pass phrase.

You enter the password or pass phrase.  @value{tramp} sends it to the remote
host, followed by a newline.

@item
@value{tramp} now waits for the shell prompt or for a message that the login
failed.

If @value{tramp} sees neither of them after a certain period of time
(a minute, say), then it issues an error message saying that it
couldn't find the remote shell prompt and shows you what the remote
host has sent.

If @value{tramp} sees a @samp{login failed} message, it tells you so,
aborts the login attempt and allows you to try again.

@item
Suppose that the login was successful and @value{tramp} sees the shell prompt
from the remote host.  Now @value{tramp} invokes @command{/bin/sh} because
Bourne shells and C shells have different command
syntaxes.@footnote{Invoking @command{/bin/sh} will fail if your login
shell doesn't recognize @samp{exec /bin/sh} as a valid command.
Maybe you use the Scheme shell @command{scsh}@dots{}}

After the Bourne shell has come up, @value{tramp} sends a few commands to
ensure a good working environment.  It turns off echoing, it sets the
shell prompt, and a few other things.

@item
Now the remote shell is up and it good working order.  Remember, what
was supposed to happen is that @value{tramp} tries to find out what files exist
on the remote host so that it can do filename completion.

So, @value{tramp} basically issues @command{cd} and @command{ls} commands and
also sometimes @command{echo} with globbing.  Another command that is
often used is @command{test} to find out whether a file is writable or a
directory or the like.  The output of each command is parsed for the
necessary operation.

@item
Suppose you are finished with filename completion, have entered @kbd{C-x
C-f}, a full file name and hit @kbd{@key{RET}}.  Now comes the time to
transfer the file contents from the remote host to the local host so
that you can edit them.

See above for an explanation of how @value{tramp} transfers the file contents.

For inline transfers, @value{tramp} issues a command like @samp{mimencode -b
/path/to/remote/file}, waits until the output has accumulated in the
buffer that's used for communication, then decodes that output to
produce the file contents.

For out-of-band transfers, @value{tramp} issues a command like the following:
@example
rcp user@@host:/path/to/remote/file /tmp/tramp.4711
@end example
It then reads the local temporary file @file{/tmp/tramp.4711} into a
buffer and deletes the temporary file.

@item
You now edit the buffer contents, blithely unaware of what has happened
behind the scenes.  (Unless you have read this section, that is.)  When
you are finished, you type @kbd{C-x C-s} to save the buffer.

@item
Again, @value{tramp} transfers the file contents to the remote host either
inline or out-of-band.  This is the reverse of what happens when reading
the file.
@end itemize

I hope this has provided you with a basic overview of what happens
behind the scenes when you open a file with @value{tramp}.


@c For the end user
@node Obtaining Tramp
@chapter Obtaining Tramp.
@cindex obtaining Tramp

@value{tramp} is freely available on the Internet and the latest
release may be downloaded from
@uref{ftp://ftp.gnu.org/gnu/tramp/}.  This release includes the full
documentation and code for @value{tramp}, suitable for installation.
But GNU Emacs (22 or later) includes @value{tramp} already, and there
is a @value{tramp} package for XEmacs, as well.  So maybe it is easier
to just use those.  But if you want the bleeding edge, read
on@dots{...}

For the especially brave, @value{tramp} is available from CVS.  The CVS
version is the latest version of the code and may contain incomplete
features or new issues.  Use these versions at your own risk.

Instructions for obtaining the latest development version of @value{tramp}
from CVS can be found by going to the Savannah project page at the
following URL and then clicking on the CVS link in the navigation bar
at the top.

@noindent
@uref{http://savannah.gnu.org/projects/tramp/}

@noindent
Or follow the example session below:

@example
] @strong{cd ~/@value{emacsdir}}
] @strong{export CVS_RSH="ssh"}
] @strong{cvs -z3 -d:ext:anoncvs@@savannah.gnu.org:/cvsroot/tramp co tramp}
@end example

@noindent
You should now have a directory @file{~/@value{emacsdir}/tramp}
containing the latest version of @value{tramp}.  You can fetch the latest
updates from the repository by issuing the command:

@example
] @strong{cd ~/@value{emacsdir}/tramp}
] @strong{export CVS_RSH="ssh"}
] @strong{cvs update -d}
@end example

@noindent
Once you've got updated files from the CVS repository, you need to run
@command{autoconf} in order to get an up-to-date @file{configure}
script:

@example
] @strong{cd ~/@value{emacsdir}/tramp}
] @strong{autoconf}
@end example

People who have no direct CVS access (maybe because sitting behind a
blocking firewall), can try the
@uref{http://savannah.gnu.org/cvs-backup/tramp-sources.tar.gz, Nightly
CVS Tree Tarball} instead of.


@node History
@chapter History of @value{tramp}
@cindex history
@cindex development history

Development was started end of November 1998.  The package was called
@file{rssh.el}, back then.  It only provided one method to access a
file, using @command{ssh} to log in to a remote host and using
@command{scp} to transfer the file contents.  After a while, the name
was changed to @file{rcp.el}, and now it's @value{tramp}.  Along the way,
many more methods for getting a remote shell and for transferring the
file contents were added.  Support for VC was added.

The most recent addition of major features were the multi-hop methods
added in April 2000 and the unification of @value{tramp} and Ange-FTP
filenames in July 2002.  In July 2004, multi-hop methods have been
replaced by proxy hosts.  Running commands on remote hosts was
introduced in December 2005.
@ifset emacsgw
Support of gateways exists since April 2007.
@end ifset

In December 2001, @value{tramp} has been added to the XEmacs package
repository.  Being part of the GNU Emacs repository happened in June
2002, the first release including @value{tramp} was GNU Emacs 22.1.

@value{tramp} is also a GNU/Linux Debian package since February 2001.


@c Installation chapter is necessary only in case of standalone
@c installation.  Text taken from trampinst.texi.
@ifset installchapter
@include trampinst.texi
@end ifset

@node Configuration
@chapter Configuring @value{tramp} for use
@cindex configuration

@cindex default configuration
@value{tramp} is (normally) fully functional when it is initially
installed.  It is initially configured to use the @command{scp}
program to connect to the remote host.  So in the easiest case, you
just type @kbd{C-x C-f} and then enter the filename
@file{@trampfn{, user, machine, /path/to.file}}.

On some hosts, there are problems with opening a connection.  These are
related to the behavior of the remote shell.  See @xref{Remote shell
setup}, for details on this.

If you do not wish to use these commands to connect to the remote
host, you should change the default connection and transfer method
that @value{tramp} uses.  There are several different methods that @value{tramp}
can use to connect to remote machines and transfer files
(@pxref{Connection types}).

If you don't know which method is right for you, see @xref{Default
Method}.


@menu
* Connection types::            Types of connections made to remote machines.
* Inline methods::              Inline methods.
* External transfer methods::   External transfer methods.
@ifset emacsgw
* Gateway methods::             Gateway methods.
@end ifset
* Default Method::              Selecting a default method.
                                  Here we also try to help those who
                                  don't have the foggiest which method
                                  is right for them.
* Default User::                Selecting a default user.
* Default Host::                Selecting a default host.
* Multi-hops::                  Connecting to a remote host using multiple hops.
* Customizing Methods::         Using Non-Standard Methods.
* Customizing Completion::      Selecting config files for user/host name completion.
* Password handling::           Reusing passwords for several connections.
* Connection caching::          Reusing connection related information.
* Remote Programs::             How @value{tramp} finds and uses programs on the remote machine.
* Remote shell setup::          Remote shell setup hints.
* Windows setup hints::         Issues with Cygwin ssh.
* Auto-save and Backup::        Auto-save and Backup.
@end menu


@node Connection types
@section Types of connections made to remote machines.
@cindex connection types, overview

There are two basic types of transfer methods, each with its own
advantages and limitations.  Both types of connection make use of a
remote shell access program such as @command{rsh}, @command{ssh} or
@command{telnet} to connect to the remote machine.

This connection is used to perform many of the operations that @value{tramp}
requires to make the remote file system transparently accessible from
the local machine.  It is only when visiting files that the methods
differ.

@cindex inline methods
@cindex external transfer methods
@cindex external methods
@cindex out-of-band methods
@cindex methods, inline
@cindex methods, external transfer
@cindex methods, out-of-band
Loading or saving a remote file requires that the content of the file
be transfered between the two machines.  The content of the file can be
transfered over the same connection used to log in to the remote
machine or the file can be transfered through another connection using
a remote copy program such as @command{rcp}, @command{scp} or
@command{rsync}.  The former are called @dfn{inline methods}, the
latter are called @dfn{out-of-band methods} or @dfn{external transfer
methods} (@dfn{external methods} for short).

The performance of the external transfer methods is generally better
than that of the inline methods, at least for large files.  This is
caused by the need to encode and decode the data when transferring
inline.

The one exception to this rule are the @command{scp} based transfer
methods.  While these methods do see better performance when actually
transferring files, the overhead of the cryptographic negotiation at
startup may drown out the improvement in file transfer times.

External transfer methods should be configured such a way that they
don't require a password (with @command{ssh-agent}, or such alike).
Modern @command{scp} implementations offer options to reuse existing
@command{ssh} connections, see method @command{scpc}.  If it isn't
possible, you should consider @ref{Password handling}, otherwise you
will be prompted for a password every copy action.


@node Inline methods
@section Inline methods
@cindex inline methods
@cindex methods, inline

The inline methods in @value{tramp} are quite powerful and can work in
situations where you cannot use an external transfer program to connect.
Inline methods are the only methods that work when connecting to the
remote machine via telnet.  (There are also strange inline methods which
allow you to transfer files between @emph{user identities} rather than
hosts, see below.)

These methods depend on the existence of a suitable encoding and
decoding command on remote machine.  Locally, @value{tramp} may be able to
use features of @value{emacsname} to decode and encode the files or
it may require access to external commands to perform that task.

@cindex uuencode
@cindex mimencode
@cindex base-64 encoding
@value{tramp} checks the availability and usability of commands like
@command{mimencode} (part of the @command{metamail} package) or
@command{uuencode} on the remote host.  The first reliable command
will be used.  The search path can be customized, see @ref{Remote
Programs}.

If both commands aren't available on the remote host, @value{tramp}
transfers a small piece of Perl code to the remote host, and tries to
apply it for encoding and decoding.


@table @asis
@item @option{rsh}
@cindex method rsh
@cindex rsh method

Connect to the remote host with @command{rsh}.  Due to the unsecure
connection it is recommended for very local host topology only.

On operating systems which provide the command @command{remsh} instead
of @command{rsh}, you can use the method @option{remsh}.  This is true
for HP-UX or Cray UNICOS, for example.


@item @option{ssh}
@cindex method ssh
@cindex ssh method

Connect to the remote host with @command{ssh}.  This is identical to
the previous option except that the @command{ssh} package is used,
making the connection more secure.

There are also two variants, @option{ssh1} and @option{ssh2}, that
call @samp{ssh -1} and @samp{ssh -2}, respectively.  This way, you can
explicitly select whether you want to use the SSH protocol version 1
or 2 to connect to the remote host.  (You can also specify in
@file{~/.ssh/config}, the SSH configuration file, which protocol
should be used, and use the regular @option{ssh} method.)

Two other variants, @option{ssh1_old} and @option{ssh2_old}, use the
@command{ssh1} and @command{ssh2} commands explicitly.  If you don't
know what these are, you do not need these options.

All the methods based on @command{ssh} have an additional kludgy
feature: you can specify a host name which looks like @file{host#42}
(the real host name, then a hash sign, then a port number).  This
means to connect to the given host but to also pass @code{-p 42} as
arguments to the @command{ssh} command.


@item @option{telnet}
@cindex method telnet
@cindex telnet method

Connect to the remote host with @command{telnet}.  This is as unsecure
as the @option{rsh} method.


@item @option{su}
@cindex method su
@cindex su method

This method does not connect to a remote host at all, rather it uses
the @command{su} program to allow you to edit files as another user.
That means, the specified host name in the file name must be either
@samp{localhost} or the host name as returned by the function
@command{(system-name)}.  For an exception of this rule see
@ref{Multi-hops}.


@item @option{sudo}
@cindex method sudo
@cindex sudo method

This is similar to the @option{su} method, but it uses @command{sudo}
rather than @command{su} to become a different user.

Note that @command{sudo} must be configured to allow you to start a
shell as the user.  It would be nice if it was sufficient if
@command{ls} and @command{mimencode} were allowed, but that is not
easy to implement, so I haven't got around to it, yet.


@item @option{sshx}
@cindex method sshx
@cindex sshx method

As you would expect, this is similar to @option{ssh}, only a little
different.  Whereas @option{ssh} opens a normal interactive shell on
the remote host, this option uses @samp{ssh -t -t @var{host} -l
@var{user} /bin/sh} to open a connection.  This is useful for users
where the normal login shell is set up to ask them a number of
questions when logging in.  This procedure avoids these questions, and
just gives @value{tramp} a more-or-less `standard' login shell to work
with.

Note that this procedure does not eliminate questions asked by
@command{ssh} itself.  For example, @command{ssh} might ask ``Are you
sure you want to continue connecting?'' if the host key of the remote
host is not known.  @value{tramp} does not know how to deal with such a
question (yet), therefore you will need to make sure that you can log
in without such questions.

This is also useful for Windows users where @command{ssh}, when
invoked from an @value{emacsname} buffer, tells them that it is not
allocating a pseudo tty.  When this happens, the login shell is wont
to not print any shell prompt, which confuses @value{tramp} mightily.
For reasons unknown, some Windows ports for @command{ssh} require the
doubled @samp{-t} option.

This supports the @samp{-p} kludge.


@item @option{krlogin}
@cindex method krlogin
@cindex krlogin method
@cindex Kerberos (with krlogin method)

This method is also similar to @option{ssh}.  It only uses the
@command{krlogin -x} command to log in to the remote host.


@item @option{plink}
@cindex method plink
@cindex plink method

This method is mostly interesting for Windows users using the PuTTY
implementation of SSH.  It uses @samp{plink -ssh} to log in to the
remote host.

This supports the @samp{-P} kludge.

Additionally, the methods @option{plink1} and @option{plink2} are
provided, which call @samp{plink -1 -ssh} or @samp{plink -2 -ssh} in
order to use SSH protocol version 1 or 2 explicitly.

CCC: Do we have to connect to the remote host once from the command
line to accept the SSH key?  Maybe this can be made automatic?

CCC: Say something about the first shell command failing.  This might
be due to a wrong setting of @code{tramp-rsh-end-of-line}.


@item @option{plinkx}
@cindex method plinkx
@cindex plinkx method

Another method using PuTTY on Windows.  Instead of host names, it
expects PuTTY session names, calling @samp{plink -load @var{session}
-t"}.  User names are relevant only in case the corresponding session
hasn't defined a user name.  Different port numbers must be defined in
the session.


@item @option{fish}
@cindex method fish
@cindex fish method

This is an experimental implementation of the fish protocol, known from
the GNU Midnight Commander or the KDE Konqueror.  @value{tramp} expects
the fish server implementation from the KDE kioslave.  That means, the
file @file{~/.fishsrv.pl} is expected to reside on the remote host.

The implementation lacks good performance.  The code is offered anyway,
maybe somebody can improve the performance.

@end table


@node External transfer methods
@section External transfer methods
@cindex methods, external transfer
@cindex methods, out-of-band
@cindex external transfer methods
@cindex out-of-band methods

The external transfer methods operate through multiple channels, using
the remote shell connection for many actions while delegating file
transfers to an external transfer utility.

This saves the overhead of encoding and decoding that multiplexing the
transfer through the one connection has with the inline methods.

Since external transfer methods need their own overhead opening a new
channel, all files which are smaller than @var{tramp-copy-size-limit}
are still transferred with the corresponding inline method.  It should
provide a fair trade-off between both approaches.

@table @asis
@item @option{rcp}  ---  @command{rsh} and @command{rcp}
@cindex method rcp
@cindex rcp method
@cindex rcp (with rcp method)
@cindex rsh (with rcp method)

This method uses the @command{rsh} and @command{rcp} commands to connect
to the remote machine and transfer files.  This is probably the fastest
connection method available.

The alternative method @option{remcp} uses the @command{remsh} and
@command{rcp} commands.  It should be applied on machines where
@command{remsh} is used instead of @command{rsh}.


@item @option{scp}  ---  @command{ssh} and @command{scp}
@cindex method scp
@cindex scp method
@cindex scp (with scp method)
@cindex ssh (with scp method)

Using @command{ssh} to connect to the remote host and @command{scp} to
transfer files between the machines is the best method for securely
connecting to a remote machine and accessing files.

The performance of this option is also quite good.  It may be slower than
the inline methods when you often open and close small files however.
The cost of the cryptographic handshake at the start of an @command{scp}
session can begin to absorb the advantage that the lack of encoding and
decoding presents.

There are also two variants, @option{scp1} and @option{scp2}, that
call @samp{ssh -1} and @samp{ssh -2}, respectively.  This way, you can
explicitly select whether you want to use the SSH protocol version 1
or 2 to connect to the remote host.  (You can also specify in
@file{~/.ssh/config}, the SSH configuration file, which protocol
should be used, and use the regular @option{scp} method.)

Two other variants, @option{scp1_old} and @option{scp2_old}, use the
@command{ssh1} and @command{ssh2} commands explicitly.  If you don't
know what these are, you do not need these options.

All the @command{ssh} based methods support the kludgy @samp{-p}
feature where you can specify a port number to connect to in the host
name.  For example, the host name @file{host#42} tells @value{tramp} to
specify @samp{-p 42} in the argument list for @command{ssh}, and to
specify @samp{-P 42} in the argument list for @command{scp}.


@item @option{sftp}  ---  @command{ssh} and @command{sftp}
@cindex method sftp
@cindex sftp method
@cindex sftp (with sftp method)
@cindex ssh (with sftp method)

That is mostly the same method as @option{scp}, but using
@command{sftp} as transfer command.  So the same remarks are valid.

This command does not work like @value{ftppackagename}, where
@command{ftp} is called interactively, and all commands are send from
within this session.  Instead of, @command{ssh} is used for login.

This method supports the @samp{-p} hack.


@item @option{rsync}  ---  @command{ssh} and @command{rsync}
@cindex method rsync
@cindex rsync method
@cindex rsync (with rsync method)
@cindex ssh (with rsync method)

Using the @command{ssh} command to connect securely to the remote
machine and the @command{rsync} command to transfer files is almost
identical to the @option{scp} method.

While @command{rsync} performs much better than @command{scp} when
transferring files that exist on both hosts, this advantage is lost if
the file exists only on one side of the connection.

The @command{rsync} based method may be considerably faster than the
@command{rcp} based methods when writing to the remote system.  Reading
files to the local machine is no faster than with a direct copy.

This method supports the @samp{-p} hack.


@item @option{scpx} --- @command{ssh} and @command{scp}
@cindex method scpx
@cindex scpx method
@cindex scp (with scpx method)
@cindex ssh (with scpx method)

As you would expect, this is similar to @option{scp}, only a little
different.  Whereas @option{scp} opens a normal interactive shell on
the remote host, this option uses @samp{ssh -t -t @var{host} -l
@var{user} /bin/sh} to open a connection.  This is useful for users
where the normal login shell is set up to ask them a number of
questions when logging in.  This procedure avoids these questions, and
just gives @value{tramp} a more-or-less `standard' login shell to work
with.

This is also useful for Windows users where @command{ssh}, when
invoked from an @value{emacsname} buffer, tells them that it is not
allocating a pseudo tty.  When this happens, the login shell is wont
to not print any shell prompt, which confuses @value{tramp} mightily.

This method supports the @samp{-p} hack.


@item @option{scpc} --- @command{ssh} and @command{scp}
@cindex method scpx
@cindex scpx method
@cindex scp (with scpx method)
@cindex ssh (with scpx method)

Newer versions of @option{ssh} (for example OpenSSH 4) offer an option
@option{ControlMaster}.  This allows @option{scp} to reuse an existing
@option{ssh} channel, which increases performance.

Before you use this method, you shall check whether your @option{ssh}
implementation does support this option.  Try from the command line

@example
ssh localhost -o ControlMaster=yes
@end example

This method supports the @samp{-p} hack.


@item @option{pscp} --- @command{plink} and @command{pscp}
@cindex method pscp
@cindex pscp method
@cindex pscp (with pscp method)
@cindex plink (with pscp method)
@cindex PuTTY (with pscp method)

This method is similar to @option{scp}, but it uses the
@command{plink} command to connect to the remote host, and it uses
@command{pscp} for transferring the files.  These programs are part
of PuTTY, an SSH implementation for Windows.

This method supports the @samp{-P} hack.


@item @option{psftp} --- @command{plink} and @command{psftp}
@cindex method psftp
@cindex psftp method
@cindex psftp (with psftp method)
@cindex plink (with psftp method)
@cindex PuTTY (with psftp method)

As you would expect, this method is similar to @option{sftp}, but it
uses the @command{plink} command to connect to the remote host, and it
uses @command{psftp} for transferring the files.  These programs are
part of PuTTY, an SSH implementation for Windows.

This method supports the @samp{-P} hack.


@item @option{fcp} --- @command{fsh} and @command{fcp}
@cindex method fcp
@cindex fcp method
@cindex fsh (with fcp method)
@cindex fcp (with fcp method)

This method is similar to @option{scp}, but it uses the @command{fsh}
command to connect to the remote host, and it uses @command{fcp} for
transferring the files.  @command{fsh/fcp} are a front-end for
@command{ssh} which allow for reusing the same @command{ssh} session
for submitting several commands.  This avoids the startup overhead of
@command{scp} (which has to establish a secure connection whenever it
is called).  Note, however, that you can also use one of the inline
methods to achieve a similar effect.

This method uses the command @samp{fsh @var{host} -l @var{user}
/bin/sh -i} to establish the connection, it does not work to just say
@command{fsh @var{host} -l @var{user}}.

@cindex method fsh
@cindex fsh method

There is no inline method using @command{fsh} as the multiplexing
provided by the program is not very useful in our context.  @value{tramp}
opens just one connection to the remote host and then keeps it open,
anyway.


@item @option{ftp}
@cindex method ftp
@cindex ftp method

This is not a native @value{tramp} method.  Instead of, it forwards all
requests to @value{ftppackagename}.
@ifset xemacs
This works only for unified filenames, see @ref{Issues}.
@end ifset


@item @option{smb} --- @command{smbclient}
@cindex method smb
@cindex smb method

This is another not natural @value{tramp} method.  It uses the
@command{smbclient} command on different Unices in order to connect to
an SMB server.  An SMB server might be a Samba (or CIFS) server on
another UNIX host or, more interesting, a host running MS Windows.  So
far, it is tested towards MS Windows NT, MS Windows 2000, and MS
Windows XP.

The first directory in the localname must be a share name on the remote
host.  Remember, that the @code{$} character in which default shares
usually end, must be written @code{$$} due to environment variable
substitution in file names.  If no share name is given (i.e. remote
directory @code{/}), all available shares are listed.

Since authorization is done on share level, you will be prompted
always for a password if you access another share on the same host.
This can be suppressed by @ref{Password handling}.

MS Windows uses for authorization both a user name and a domain name.
Because of this, the @value{tramp} syntax has been extended: you can
specify a user name which looks like @code{user%domain} (the real user
name, then a percent sign, then the domain name).  So, to connect to
the machine @code{melancholia} as user @code{daniel} of the domain
@code{BIZARRE}, and edit @file{.emacs} in the home directory (share
@code{daniel$}) I would specify the filename @file{@trampfn{smb,
daniel%BIZARRE, melancholia, /daniel$$/.emacs}}.

Depending on the Windows domain configuration, a Windows user might be
considered as domain user per default.  In order to connect as local
user, the WINS name of that machine must be given as domain name.
Usually, it is the machine name in capital letters.  In the example
above, the local user @code{daniel} would be specified as
@file{@trampfn{smb, daniel%MELANCHOLIA, melancholia, /daniel$$/.emacs}}.

The domain name as well as the user name are optional.  If no user
name is specified at all, the anonymous user (without password
prompting) is assumed.  This is different from all other @value{tramp}
methods, where in such a case the local user name is taken.

The @option{smb} method supports the @samp{-p} hack.

@strong{Please note:} If @value{emacsname} runs locally under MS
Windows, this method isn't available.  Instead of, you can use UNC
file names like @file{//melancholia/daniel$$/.emacs}.  The only
disadvantage is that there's no possibility to specify another user
name.

@end table


@ifset emacsgw
@node Gateway methods
@section Gateway methods
@cindex methods, gateway
@cindex gateway methods

Gateway methods are not methods to access a remote host directly.
These methods are intended to pass firewalls or proxy servers.
Therefore, they can be used for proxy host declarations
(@pxref{Multi-hops}) only.

A gateway method must come always along with a method who supports
port setting (referred to as @samp{-p} kludge).  This is because
@value{tramp} targets the accompanied method to
@file{localhost#random_port}, from where the firewall or proxy server
is accessed to.

Gateway methods support user name and password declarations.  These
are used to authenticate towards the corresponding firewall or proxy
server.  They can be passed only if your friendly administrator has
granted your access.

@table @asis
@item @option{tunnel}
@cindex method tunnel
@cindex tunnel method

This method implements an HTTP tunnel via the @command{CONNECT}
command (see RFC 2616, 2817).  Any HTTP 1.1 compliant (proxy) server
shall support this command.

As authentication method, only @option{Basic Authentication} (see RFC
2617) is implemented so far.  If no port number is given in the
declaration, port @option{8080} is used for the proxy server.


@item @option{socks}
@cindex method socks
@cindex socks method

The @command{socks} method provides access to SOCKSv5 servers (see
RFC 1928).  @option{Username/Password Authentication} according to RFC
1929 is supported.

The default port number of the socks server is @option{1080}, if not
specified otherwise.

@end table
@end ifset


@node Default Method
@section Selecting a default method
@cindex default method

@vindex tramp-default-method
When you select an appropriate transfer method for your typical usage
you should set the variable @code{tramp-default-method} to reflect that
choice.  This variable controls which method will be used when a method
is not specified in the @value{tramp} file name.  For example:

@lisp
(setq tramp-default-method "ssh")
@end lisp

@vindex tramp-default-method-alist
You can also specify different methods for certain user/host
combinations, via the variable @code{tramp-default-method-alist}.  For
example, the following two lines specify to use the @option{ssh}
method for all user names matching @samp{john} and the @option{rsync}
method for all host names matching @samp{lily}.  The third line
specifies to use the @option{su} method for the user @samp{root} on
the machine @samp{localhost}.

@lisp
(add-to-list 'tramp-default-method-alist '("" "john" "ssh"))
(add-to-list 'tramp-default-method-alist '("lily" "" "rsync"))
(add-to-list 'tramp-default-method-alist
             '("\\`localhost\\'" "\\`root\\'" "su"))
@end lisp

@noindent
See the documentation for the variable
@code{tramp-default-method-alist} for more details.

External transfer methods are normally preferable to inline transfer
methods, giving better performance.

@xref{Inline methods}.
@xref{External transfer methods}.

Another consideration with the selection of transfer methods is the
environment you will use them in and, especially when used over the
Internet, the security implications of your preferred method.

The @option{rsh} and @option{telnet} methods send your password as
plain text as you log in to the remote machine, as well as
transferring the files in such a way that the content can easily be
read from other machines.

If you need to connect to remote systems that are accessible from the
Internet, you should give serious thought to using @option{ssh} based
methods to connect.  These provide a much higher level of security,
making it a non-trivial exercise for someone to obtain your password
or read the content of the files you are editing.


@subsection Which method is the right one for me?
@cindex choosing the right method

Given all of the above, you are probably thinking that this is all fine
and good, but it's not helping you to choose a method!  Right you are.
As a developer, we don't want to boss our users around but give them
maximum freedom instead.  However, the reality is that some users would
like to have some guidance, so here I'll try to give you this guidance
without bossing you around.  You tell me whether it works @dots{}

My suggestion is to use an inline method.  For large files, out-of-band
methods might be more efficient, but I guess that most people will want
to edit mostly small files.

I guess that these days, most people can access a remote machine by
using @command{ssh}.  So I suggest that you use the @option{ssh}
method.  So, type @kbd{C-x C-f @trampfn{ssh, root, otherhost,
/etc/motd} @key{RET}} to edit the @file{/etc/motd} file on the other
host.

If you can't use @option{ssh} to log in to the remote host, then
select a method that uses a program that works.  For instance, Windows
users might like the @option{plink} method which uses the PuTTY
implementation of @command{ssh}.  Or you use Kerberos and thus like
@option{krlogin}.

For the special case of editing files on the local host as another
user, see the @option{su} or @option{sudo} methods.  They offer
shortened syntax for the @samp{root} account, like
@file{@trampfn{su, , , /etc/motd}}.

People who edit large files may want to consider @option{scpc} instead
of @option{ssh}, or @option{pscp} instead of @option{plink}.  These
out-of-band methods are faster than inline methods for large files.
Note, however, that out-of-band methods suffer from some limitations.
Please try first whether you really get a noticeable speed advantage
from using an out-of-band method!  Maybe even for large files, inline
methods are fast enough.


@node Default User
@section Selecting a default user
@cindex default user

The user part of a @value{tramp} file name can be omitted.  Usually,
it is replaced by the user name you are logged in.  Often, this is not
what you want.  A typical use of @value{tramp} might be to edit some
files with root permissions on the local host.  This case, you should
set the variable @code{tramp-default-user} to reflect that choice.
For example:

@lisp
(setq tramp-default-user "root")
@end lisp

@code{tramp-default-user} is regarded as obsolete, and will be removed
soon.

@vindex tramp-default-user-alist
You can also specify different users for certain method/host
combinations, via the variable @code{tramp-default-user-alist}.  For
example, if you always have to use the user @samp{john} in the domain
@samp{somewhere.else}, you can specify the following:

@lisp
(add-to-list 'tramp-default-user-alist
             '("ssh" ".*\\.somewhere\\.else\\'" "john"))
@end lisp

@noindent
See the documentation for the variable
@code{tramp-default-user-alist} for more details.

One trap to fall in must be known.  If @value{tramp} finds a default
user, this user will be passed always to the connection command as
parameter (for example @samp{ssh here.somewhere.else -l john}.  If you
have specified another user for your command in its configuration
files, @value{tramp} cannot know it, and the remote access will fail.
If you have specified in the given example in @file{~/.ssh/config} the
lines

@example
Host here.somewhere.else
     User lily
@end example

@noindent
than you must discard selecting a default user by @value{tramp}.  This
will be done by setting it to @code{nil} (or @samp{lily}, likewise):

@lisp
(add-to-list 'tramp-default-user-alist
             '("ssh" "\\`here\\.somewhere\\.else\\'" nil))
@end lisp

The last entry in @code{tramp-default-user-alist} could be your
default user you'll apply predominantly.  You shall @emph{append} it
to that list at the end:

@lisp
(add-to-list 'tramp-default-user-alist '(nil nil "jonas") t)
@end lisp


@node Default Host
@section Selecting a default host
@cindex default host

@vindex tramp-default-host
Finally, it is even possible to omit the host name part of a
@value{tramp} file name.  This case, the value of the variable
@code{tramp-default-host} is used.  Per default, it is initialized
with the host name your local @value{emacsname} is running.

If you, for example, use @value{tramp} mainly to contact the host
@samp{target} as user @samp{john}, you can specify:

@lisp
(setq tramp-default-user "john"
      tramp-default-host "target")
@end lisp

Then the simple file name @samp{@trampfn{ssh, , ,}} will connect you
to John's home directory on target.
@ifset emacs
Note, however, that the most simplification @samp{/::} won't work,
because @samp{/:} is the prefix for quoted file names.
@end ifset


@node Multi-hops
@section Connecting to a remote host using multiple hops
@cindex multi-hop
@cindex proxy hosts

Sometimes, the methods described before are not sufficient.  Sometimes,
it is not possible to connect to a remote host using a simple command.
For example, if you are in a secured network, you might have to log in
to a `bastion host' first before you can connect to the outside world.
Of course, the target host may also require a bastion host.

@vindex tramp-default-proxies-alist
In order to specify such multiple hops, it is possible to define a proxy
host to pass through, via the variable
@code{tramp-default-proxies-alist}.  This variable keeps a list of
triples (@var{host} @var{user} @var{proxy}).

 The first matching item specifies the proxy host to be passed for a
file name located on a remote target matching @var{user}@@@var{host}.
@var{host} and @var{user} are regular expressions or @code{nil}, which
is interpreted as a regular expression which always matches.

@var{proxy} must be a Tramp filename which localname part is ignored.
Method and user name on @var{proxy} are optional, which is interpreted
with the default values.
@ifset emacsgw
The method must be an inline or gateway method (@pxref{Inline
methods}, @pxref{Gateway methods}).
@end ifset
@ifclear emacsgw
The method must be an inline method (@pxref{Inline methods}).
@end ifclear
If @var{proxy} is @code{nil}, no additional hop is required reaching
@var{user}@@@var{host}.

If you, for example, must pass the host @samp{bastion.your.domain} as
user @samp{bird} for any remote host which is not located in your local
domain, you can set

@lisp
(add-to-list 'tramp-default-proxies-alist
             '("\\." nil "@trampfn{ssh, bird, bastion.your.domain,}"))
(add-to-list 'tramp-default-proxies-alist
             '("\\.your\\.domain\\'" nil nil))
@end lisp

Please note the order of the code.  @code{add-to-list} adds elements at the
beginning of a list.  Therefore, most relevant rules must be added last.

Proxy hosts can be cascaded.  If there is another host called
@samp{jump.your.domain}, which is the only one in your local domain who
is allowed connecting @samp{bastion.your.domain}, you can add another
rule:

@lisp
(add-to-list 'tramp-default-proxies-alist
             '("\\`bastion\\.your\\.domain\\'"
               "\\`bird\\'"
               "@trampfn{ssh, , jump.your.domain,}"))
@end lisp

@var{proxy} can contain the patterns @code{%h} or @code{%u}.  These
patterns are replaced by the strings matching @var{host} or
@var{user}, respectively.

If you, for example, wants to work as @samp{root} on hosts in the
domain @samp{your.domain}, but login as @samp{root} is disabled for
non-local access, you might add the following rule:

@lisp
(add-to-list 'tramp-default-proxies-alist
             '("\\.your\\.domain\\'" "\\`root\\'" "@trampfn{ssh, , %h,}"))
@end lisp

Opening @file{@trampfn{sudo, , randomhost.your.domain,}} would connect
first @samp{randomhost.your.domain} via @code{ssh} under your account
name, and perform @code{sudo -u root} on that host afterwards.  It is
important to know that the given method is applied on the host which
has been reached so far.  @code{sudo -u root}, applied on your local
host, wouldn't be useful here.

This is the recommended configuration to work as @samp{root} on remote
Ubuntu hosts.

@ifset emacsgw
Finally, @code{tramp-default-proxies-alist} can be used to pass
firewalls or proxy servers.  Imagine your local network has a host
@samp{proxy.your.domain} which is used on port 3128 as HTTP proxy to
the outer world.  Your friendly administrator has granted you access
under your user name to @samp{host.other.domain} on that proxy
server.@footnote{HTTP tunnels are intended for secure SSL/TLS
communication.  Therefore, many proxy server restrict the tunnels to
related target ports.  You might need to run your ssh server on your
target host @samp{host.other.domain} on such a port, like 443 (https).
See @uref{http://savannah.gnu.org/maintenance/CvsFromBehindFirewall}
for discussion of ethical issues.}  You would need to add the
following rule:

@lisp
(add-to-list 'tramp-default-proxies-alist
             '("\\`host\\.other\\.domain\\'" nil
               "@trampfn{tunnel, , proxy.your.domain#3128,}"))
@end lisp

Gateway methods can be declared as first hop only in a multiple hop
chain.
@end ifset


@node Customizing Methods
@section Using Non-Standard Methods
@cindex customizing methods
@cindex using non-standard methods
@cindex create your own methods

There is a variable @code{tramp-methods} which you can change if the
predefined methods don't seem right.

For the time being, I'll refer you to the Lisp documentation of that
variable, accessible with @kbd{C-h v tramp-methods @key{RET}}.


@node Customizing Completion
@section Selecting config files for user/host name completion
@cindex customizing completion
@cindex selecting config files
@vindex tramp-completion-function-alist

The variable @code{tramp-completion-function-alist} is intended to
customize which files are taken into account for user and host name
completion (@pxref{Filename completion}).  For every method, it keeps
a set of configuration files, accompanied by a Lisp function able to
parse that file.  Entries in @code{tramp-completion-function-alist}
have the form (@var{method} @var{pair1} @var{pair2} ...).

Each @var{pair} is composed of (@var{function} @var{file}).
@var{function} is responsible to extract user names and host names
from @var{file} for completion.  There are two functions which access
this variable:

@defun tramp-get-completion-function method
This function returns the list of completion functions for @var{method}.

Example:
@example
(tramp-get-completion-function "rsh")

     @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
         (tramp-parse-rhosts "~/.rhosts"))
@end example
@end defun

@defun tramp-set-completion-function method function-list
This function sets @var{function-list} as list of completion functions
for @var{method}.

Example:
@example
(tramp-set-completion-function "ssh"
 '((tramp-parse-sconfig "/etc/ssh_config")
   (tramp-parse-sconfig "~/.ssh/config")))

     @result{} ((tramp-parse-sconfig "/etc/ssh_config")
         (tramp-parse-sconfig "~/.ssh/config"))
@end example
@end defun

The following predefined functions parsing configuration files exist:

@table @asis
@item @code{tramp-parse-rhosts}
@findex tramp-parse-rhosts

This function parses files which are syntactical equivalent to
@file{~/.rhosts}.  It returns both host names and user names, if
specified.

@item @code{tramp-parse-shosts}
@findex tramp-parse-shosts

This function parses files which are syntactical equivalent to
@file{~/.ssh/known_hosts}.  Since there are no user names specified
in such files, it can return host names only.

@item @code{tramp-parse-sconfig}
@findex tramp-parse-shosts

This function returns the host nicknames defined by @code{Host} entries
in @file{~/.ssh/config} style files.

@item @code{tramp-parse-shostkeys}
@findex tramp-parse-shostkeys

SSH2 parsing of directories @file{/etc/ssh2/hostkeys/*} and
@file{~/ssh2/hostkeys/*}.  Hosts are coded in file names
@file{hostkey_@var{portnumber}_@var{host-name}.pub}.  User names
are always @code{nil}.

@item @code{tramp-parse-sknownhosts}
@findex tramp-parse-shostkeys

Another SSH2 style parsing of directories like
@file{/etc/ssh2/knownhosts/*} and @file{~/ssh2/knownhosts/*}.  This
case, hosts names are coded in file names
@file{@var{host-name}.@var{algorithm}.pub}.  User names are always @code{nil}.

@item @code{tramp-parse-hosts}
@findex tramp-parse-hosts

A function dedicated to @file{/etc/hosts} style files.  It returns
host names only.

@item @code{tramp-parse-passwd}
@findex tramp-parse-passwd

A function which parses @file{/etc/passwd} like files.  Obviously, it
can return user names only.

@item @code{tramp-parse-netrc}
@findex tramp-parse-netrc

Finally, a function which parses @file{~/.netrc} like files.
@end table

If you want to keep your own data in a file, with your own structure,
you might provide such a function as well.  This function must meet
the following conventions:

@defun my-tramp-parse file
@var{file} must be either a file name on your host, or @code{nil}.
The function must return a list of (@var{user} @var{host}), which are
taken as candidates for user and host name completion.

Example:
@example
(my-tramp-parse "~/.my-tramp-hosts")

     @result{} ((nil "toto") ("daniel" "melancholia"))
@end example
@end defun


@node Password handling
@section Reusing passwords for several connections.
@cindex passwords

Sometimes it is necessary to connect to the same remote host several
times.  Reentering passwords again and again would be annoying, when
the chosen method does not support access without password prompt
through own configuration.

The best recommendation is to use the method's own mechanism for
password handling. Consider @command{ssh-agent} for @option{ssh}-like
methods, or @command{pageant} for @option{plink}-like methods.

However, if you cannot apply such native password handling,
@value{tramp} offers altenatives.


@anchor{auth-sources}
@subsection Using an authentication file

@vindex auth-sources
The package @file{auth-source.el}, originally developed in No Gnus,
offers the possibility to read passwords from a file, like FTP does it
from @file{~/.netrc}.  The default authentication file is
@file{~/.authinfo.gpg}, this can be changed via the variable
@code{auth-sources}.

@noindent
A typical entry in the authentication file would be

@example
machine melancholia port scp login daniel password geheim
@end example

The port can be any @value{tramp} method (@pxref{Inline methods},
@pxref{External transfer methods}), to match only this method.  When
you omit the port, you match all @value{tramp} methods.


@anchor{password-cache}
@subsection Caching passwords

If there is no authentication file, @value{tramp} caches the passwords
entered by you.  They will be reused next time if a connection needs
them for the same user name and host name, independently of the
connection method.

@vindex password-cache-expiry
Passwords are not saved permanently, that means the password caching
is limited to the lifetime of your @value{emacsname} session.  You
can influence the lifetime of password caching by customizing the
variable @code{password-cache-expiry}.  The value is the number of
seconds how long passwords are cached.  Setting it to @code{nil}
disables the expiration.

@vindex password-cache
If you don't like this feature for security reasons, password caching
can be disabled totally by customizing the variable
@code{password-cache} (setting it to @code{nil}).

Implementation Note: password caching is based on the package
@file{password-cache.el}.  For the time being, it is activated only
when this package is seen in the @code{load-path} while loading
@value{tramp}.
@ifset installchapter
If you don't use No Gnus, you can take @file{password.el} from the
@value{tramp} @file{contrib} directory, see @ref{Installation
parameters}.
@end ifset


@node Connection caching
@section Reusing connection related information.
@cindex caching

@vindex tramp-persistency-file-name
In order to reduce initial connection time, @value{tramp} stores
connection related information persistently.  The variable
@code{tramp-persistency-file-name} keeps the file name where these
information are written.  Its default value is
@ifset emacs
@file{~/.emacs.d/tramp}.
@end ifset
@ifset xemacs
@file{~/.xemacs/tramp}.
@end ifset
It is recommended to choose a local file name.

@value{tramp} reads this file during startup, and writes it when
exiting @value{emacsname}.  You can simply remove this file if
@value{tramp} shall be urged to recompute these information next
@value{emacsname} startup time.

Using such persistent information can be disabled by setting
@code{tramp-persistency-file-name} to @code{nil}.

Once consequence of reusing connection related information is that
@var{tramp} needs to distinguish hosts.  If you, for example, run a
local @code{sshd} on port 3001, which tunnels @command{ssh} to another
host, you could access both @file{@trampfn{ssh, , localhost,}} and
@file{@trampfn{ssh, , localhost#3001,}}.  @var{tramp} would use the
same host related information (like paths, Perl variants, etc) for
both connections, although the information is valid only for one of
them.

In order to avoid trouble, you must use another host name for one of
the connections, like introducing a @option{Host} section in
@file{~/.ssh/config} (@pxref{Frequently Asked Questions}) or applying
multiple hops (@pxref{Multi-hops}).

When @value{tramp} detects a changed operating system version on a
remote host (via the command @command{uname -sr}), it flushes all
connection related information for this host, and opens the
connection, again.


@node Remote Programs
@section How @value{tramp} finds and uses programs on the remote machine.

@value{tramp} depends on a number of programs on the remote host in order to
function, including @command{ls}, @command{test}, @command{find} and
@command{cat}.

In addition to these required tools, there are various tools that may be
required based on the connection method.  See @ref{Inline methods} and
@ref{External transfer methods} for details on these.

Certain other tools, such as @command{perl} (or @command{perl5}) and
@command{grep} will be used if they can be found.  When they are
available, they are used to improve the performance and accuracy of
remote file access.

@vindex tramp-remote-path
When @value{tramp} connects to the remote machine, it searches for the
programs that it can use.  The variable @code{tramp-remote-path}
controls the directories searched on the remote machine.

By default, this is set to a reasonable set of defaults for most
machines.  The symbol @code{tramp-default-remote-path} is a place
holder, it is replaced by the list of directories received via the
command @command{getconf PATH} on your remote machine.  For example,
on GNU Debian this is @file{/bin:/usr/bin}, whereas on Solaris this is
@file{/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin}.  It is
recommended to apply this symbol on top of @code{tramp-remote-path}.

It is possible, however, that your local (or remote ;) system
administrator has put the tools you want in some obscure local
directory.

In this case, you can still use them with @value{tramp}.  You simply
need to add code to your @file{.emacs} to add the directory to the
remote path.  This will then be searched by @value{tramp} when you
connect and the software found.

To add a directory to the remote search path, you could use code such
as:

@lisp
@i{;; We load @value{tramp} to define the variable.}
(require 'tramp)
@i{;; We have @command{perl} in "/usr/local/perl/bin"}
(add-to-list 'tramp-remote-path "/usr/local/perl/bin")
@end lisp

@value{tramp} caches several information, like the Perl binary
location.  The changed remote search path wouldn't affect these
settings.  In order to force @value{tramp} to recompute these values,
you must exit @value{emacsname}, remove your persistency file
(@pxref{Connection caching}), and restart @value{emacsname}.


@node Remote shell setup
@section Remote shell setup hints
@cindex remote shell setup
@cindex @file{.profile} file
@cindex @file{.login} file
@cindex shell init files

As explained in the @ref{Overview} section, @value{tramp} connects to the
remote host and talks to the shell it finds there.  Of course, when you
log in, the shell executes its init files.  Suppose your init file
requires you to enter the birth date of your mother; clearly @value{tramp}
does not know this and hence fails to log you in to that host.

There are different possible strategies for pursuing this problem.  One
strategy is to enable @value{tramp} to deal with all possible situations.
This is a losing battle, since it is not possible to deal with
@emph{all} situations.  The other strategy is to require you to set up
the remote host such that it behaves like @value{tramp} expects.  This might
be inconvenient because you have to invest a lot of effort into shell
setup before you can begin to use @value{tramp}.

The package, therefore, pursues a combined approach.  It tries to
figure out some of the more common setups, and only requires you to
avoid really exotic stuff.  For example, it looks through a list of
directories to find some programs on the remote host.  And also, it
knows that it is not obvious how to check whether a file exists, and
therefore it tries different possibilities.  (On some hosts and
shells, the command @command{test -e} does the trick, on some hosts
the shell builtin doesn't work but the program @command{/usr/bin/test
-e} or @command{/bin/test -e} works.  And on still other hosts,
@command{ls -d} is the right way to do this.)

Below you find a discussion of a few things that @value{tramp} does not deal
with, and that you therefore have to set up correctly.

@table @asis
@item @var{shell-prompt-pattern}
@vindex shell-prompt-pattern

After logging in to the remote host, @value{tramp} has to wait for the remote
shell startup to finish before it can send commands to the remote
shell.  The strategy here is to wait for the shell prompt.  In order to
recognize the shell prompt, the variable @code{shell-prompt-pattern} has
to be set correctly to recognize the shell prompt on the remote host.

Note that @value{tramp} requires the match for @code{shell-prompt-pattern}
to be at the end of the buffer.  Many people have something like the
following as the value for the variable: @code{"^[^>$][>$] *"}.  Now
suppose your shell prompt is @code{a <b> c $ }.  In this case,
@value{tramp} recognizes the @code{>} character as the end of the prompt,
but it is not at the end of the buffer.

@item @var{tramp-shell-prompt-pattern}
@vindex tramp-shell-prompt-pattern

This regular expression is used by @value{tramp} in the same way as
@code{shell-prompt-pattern}, to match prompts from the remote shell.
This second variable exists because the prompt from the remote shell
might be different from the prompt from a local shell --- after all,
the whole point of @value{tramp} is to log in to remote hosts as a
different user.  The default value of
@code{tramp-shell-prompt-pattern} is the same as the default value of
@code{shell-prompt-pattern}, which is reported to work well in many
circumstances.

@item @var{tramp-password-prompt-regexp}
@vindex tramp-password-prompt-regexp
@vindex tramp-wrong-passwd-regexp

During login, @value{tramp} might be forced to enter a password or a
passphrase.  The difference between both is that a password is
requested from the shell on the remote host, while a passphrase is
needed for accessing local authentication information, like your ssh
key.

@var{tramp-password-prompt-regexp} handles the detection of such
requests for English environments.  When you use another localization
of your (local or remote) host, you might need to adapt this. Example:

@lisp
(setq
  tramp-password-prompt-regexp
    (concat
      "^.*"
      (regexp-opt
        '("passphrase" "Passphrase"
          ;; English
          "password" "Password"
          ;; Deutsch
          "passwort" "Passwort"
          ;; Fran@,{c}ais
          "mot de passe" "Mot de passe") t)
      ".*:? *"))
@end lisp

In parallel, it might also be necessary to adapt
@var{tramp-wrong-passwd-regexp}.

@item @command{tset} and other questions
@cindex Unix command tset
@cindex tset Unix command

Some people invoke the @command{tset} program from their shell startup
scripts which asks the user about the terminal type of the shell.
Maybe some shells ask other questions when they are started.
@value{tramp} does not know how to answer these questions.  There are
two approaches for dealing with this problem.  One approach is to take
care that the shell does not ask any questions when invoked from
@value{tramp}.  You can do this by checking the @code{TERM}
environment variable, it will be set to @code{dumb} when connecting.

@vindex tramp-terminal-type
The variable @code{tramp-terminal-type} can be used to change this value
to @code{dumb}.

@vindex tramp-actions-before-shell
The other approach is to teach @value{tramp} about these questions.  See
the variable @code{tramp-actions-before-shell}.  Example:

@lisp
(defconst my-tramp-prompt-regexp
  (concat (regexp-opt '("Enter the birth date of your mother:") t)
          "\\s-*")
  "Regular expression matching my login prompt question.")

(defun my-tramp-action (proc vec)
  "Enter \"19000101\" in order to give a correct answer."
  (save-window-excursion
    (with-current-buffer (tramp-get-connection-buffer vec)
      (tramp-message vec 6 "\n%s" (buffer-string))
      (tramp-send-string vec "19000101"))))

(add-to-list 'tramp-actions-before-shell
             '(my-tramp-prompt-regexp my-tramp-action))
@end lisp


@item Environment variables named like users in @file{.profile}

If you have a user named frumple and set the variable @code{FRUMPLE} in
your shell environment, then this might cause trouble.  Maybe rename
the variable to @code{FRUMPLE_DIR} or the like.

This weird effect was actually reported by a @value{tramp} user!


@item Non-Bourne commands in @file{.profile}

After logging in to the remote host, @value{tramp} issues the command
@command{exec /bin/sh}.  (Actually, the command is slightly
different.)  When @command{/bin/sh} is executed, it reads some init
files, such as @file{~/.shrc} or @file{~/.profile}.

Now, some people have a login shell which is not @code{/bin/sh} but a
Bourne-ish shell such as bash or ksh.  Some of these people might put
their shell setup into the files @file{~/.shrc} or @file{~/.profile}.
This way, it is possible for non-Bourne constructs to end up in those
files.  Then, @command{exec /bin/sh} might cause the Bourne shell to
barf on those constructs.

As an example, imagine somebody putting @command{export FOO=bar} into
the file @file{~/.profile}.  The standard Bourne shell does not
understand this syntax and will emit a syntax error when it reaches
this line.

Another example is the tilde (@code{~}) character, say when adding
@file{~/bin} to @code{$PATH}.  Many Bourne shells will not expand this
character, and since there is usually no directory whose name consists
of the single character tilde, strange things will happen.

What can you do about this?

Well, one possibility is to make sure that everything in
@file{~/.shrc} and @file{~/.profile} on all remote hosts is
Bourne-compatible.  In the above example, instead of @command{export
FOO=bar}, you might use @command{FOO=bar; export FOO} instead.

The other possibility is to put your non-Bourne shell setup into some
other files.  For example, bash reads the file @file{~/.bash_profile}
instead of @file{~/.profile}, if the former exists.  So bash
aficionados just rename their @file{~/.profile} to
@file{~/.bash_profile} on all remote hosts, and Bob's your uncle.

The @value{tramp} developers would like to circumvent this problem, so
if you have an idea about it, please tell us.  However, we are afraid
it is not that simple: before saying @command{exec /bin/sh},
@value{tramp} does not know which kind of shell it might be talking
to.  It could be a Bourne-ish shell like ksh or bash, or it could be a
csh derivative like tcsh, or it could be zsh, or even rc.  If the
shell is Bourne-ish already, then it might be prudent to omit the
@command{exec /bin/sh} step.  But how to find out if the shell is
Bourne-ish?

@end table


@node Auto-save and Backup
@section Auto-save and Backup configuration
@cindex auto-save
@cindex backup
@ifset emacs
@vindex backup-directory-alist
@end ifset
@ifset xemacs
@vindex bkup-backup-directory-info
@end ifset

Normally, @value{emacsname} writes backup files to the same directory
as the original files, but this behavior can be changed via the
variable
@ifset emacs
@code{backup-directory-alist}.
@end ifset
@ifset xemacs
@code{bkup-backup-directory-info}.
@end ifset
In connection with @value{tramp}, this can have unexpected side
effects.  Suppose that you specify that all backups should go to the
directory @file{~/.emacs.d/backups/}, and then you edit the file
@file{@trampfn{su, root, localhost, /etc/secretfile}}.  The effect is
that the backup file will be owned by you and not by root, thus
possibly enabling others to see it even if they were not intended to
see it.

When
@ifset emacs
@code{backup-directory-alist}
@end ifset
@ifset xemacs
@code{bkup-backup-directory-info}
@end ifset
is @code{nil} (the default), such problems do not occur.

Therefore, it is useful to set special values for @value{tramp}
files.  For example, the following statement effectively `turns off'
the effect of
@ifset emacs
@code{backup-directory-alist}
@end ifset
@ifset xemacs
@code{bkup-backup-directory-info}
@end ifset
for @value{tramp} files:

@ifset emacs
@lisp
(add-to-list 'backup-directory-alist
             (cons tramp-file-name-regexp nil))
@end lisp
@end ifset
@ifset xemacs
@lisp
(require 'backup-dir)
(add-to-list 'bkup-backup-directory-info
             (list tramp-file-name-regexp ""))
@end lisp
@end ifset

Another possibility is to use the @value{tramp} variable
@ifset emacs
@code{tramp-backup-directory-alist}.
@end ifset
@ifset xemacs
@code{tramp-bkup-backup-directory-info}.
@end ifset
This variable has the same meaning like
@ifset emacs
@code{backup-directory-alist}.
@end ifset
@ifset xemacs
@code{bkup-backup-directory-info}.
@end ifset
If a @value{tramp} file is backed up, and DIRECTORY is an absolute
local file name, DIRECTORY is prepended with the @value{tramp} file
name prefix of the file to be backed up.

@noindent
Example:

@ifset emacs
@lisp
(add-to-list 'backup-directory-alist
             (cons "." "~/.emacs.d/backups/"))
(setq tramp-backup-directory-alist backup-directory-alist)
@end lisp
@end ifset
@ifset xemacs
@lisp
(require 'backup-dir)
(add-to-list 'bkup-backup-directory-info
             (list "." "~/.emacs.d/backups/" 'full-path))
(setq tramp-bkup-backup-directory-info bkup-backup-directory-info)
@end lisp
@end ifset

@noindent
The backup file name of @file{@trampfn{su, root, localhost,
/etc/secretfile}} would be
@ifset emacs
@file{@trampfn{su, root, localhost,
~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile~}}
@end ifset
@ifset xemacs
@file{@trampfn{su, root, localhost,
~/.emacs.d/backups/![su!root@@localhost]!etc!secretfile~}}
@end ifset

The same problem can happen with auto-saving files.
@ifset emacs
Since @value{emacsname} 21, the variable
@code{auto-save-file-name-transforms} keeps information, on which
directory an auto-saved file should go.  By default, it is initialized
for @value{tramp} files to the local temporary directory.

On some versions of @value{emacsname}, namely the version built for
Debian GNU/Linux, the variable @code{auto-save-file-name-transforms}
contains the directory where @value{emacsname} was built.  A
workaround is to manually set the variable to a sane value.

If auto-saved files should go into the same directory as the original
files, @code{auto-save-file-name-transforms} should be set to @code{nil}.

Another possibility is to set the variable
@code{tramp-auto-save-directory} to a proper value.
@end ifset
@ifset xemacs
For this purpose you can set the variable @code{auto-save-directory}
to a proper value.
@end ifset


@node Windows setup hints
@section Issues with Cygwin ssh
@cindex Cygwin, issues

This section needs a lot of work!  Please help.

@cindex method sshx with Cygwin
@cindex sshx method with Cygwin
The recent Cygwin installation of @command{ssh} works only with a
Cygwinized @value{emacsname}.  You can check it by typing @kbd{M-x
eshell}, and starting @kbd{ssh test.machine}.  The problem is evident
if you see a message like this:

@example
Pseudo-terminal will not be allocated because stdin is not a terminal.
@end example

Older @command{ssh} versions of Cygwin are told to cooperate with
@value{tramp} selecting @option{sshx} as the connection method.  You
can find information about setting up Cygwin in their FAQ at
@uref{http://cygwin.com/faq/}.

@cindex method scpx with Cygwin
@cindex scpx method with Cygwin
If you wish to use the @option{scpx} connection method, then you might
have the problem that @value{emacsname} calls @command{scp} with a
Windows filename such as @code{c:/foo}.  The Cygwin version of
@command{scp} does not know about Windows filenames and interprets
this as a remote filename on the host @code{c}.

One possible workaround is to write a wrapper script for @option{scp}
which converts the Windows filename to a Cygwinized filename.

@cindex Cygwin and ssh-agent
@cindex SSH_AUTH_SOCK and @value{emacsname} on Windows
If you want to use either @option{ssh} based method on Windows, then
you might encounter problems with @command{ssh-agent}.  Using this
program, you can avoid typing the pass-phrase every time you log in.
However, if you start @value{emacsname} from a desktop shortcut, then
the environment variable @code{SSH_AUTH_SOCK} is not set and so
@value{emacsname} and thus @value{tramp} and thus @command{ssh} and
@command{scp} started from @value{tramp} cannot communicate with
@command{ssh-agent}.  It works better to start @value{emacsname} from
the shell.

If anyone knows how to start @command{ssh-agent} under Windows in such a
way that desktop shortcuts can profit, please holler.  I don't really
know anything at all about Windows@dots{}


@node Usage
@chapter Using @value{tramp}
@cindex using @value{tramp}

Once you have installed @value{tramp} it will operate fairly
transparently.  You will be able to access files on any remote machine
that you can log in to as though they were local.

Files are specified to @value{tramp} using a formalized syntax specifying the
details of the system to connect to.  This is similar to the syntax used
by the @value{ftppackagename} package.

@cindex type-ahead
Something that might happen which surprises you is that
@value{emacsname} remembers all your keystrokes, so if you see a
password prompt from @value{emacsname}, say, and hit @kbd{@key{RET}}
twice instead of once, then the second keystroke will be processed by
@value{emacsname} after @value{tramp} has done its thing.  Why, this
type-ahead is normal behavior, you say.  Right you are, but be aware
that opening a remote file might take quite a while, maybe half a
minute when a connection needs to be opened.  Maybe after half a
minute you have already forgotten that you hit that key!

@menu
* Filename Syntax::             @value{tramp} filename conventions.
* Alternative Syntax::          URL-like filename syntax.
* Filename completion::         Filename completion.
* Remote processes::            Integration with other @value{emacsname} packages.
* Cleanup remote connections::  Cleanup remote connections.
@end menu


@node Filename Syntax
@section @value{tramp} filename conventions
@cindex filename syntax
@cindex filename examples

To access the file @var{localname} on the remote machine @var{machine}
you would specify the filename @file{@trampfn{, , machine,
localname}}.  This will connect to @var{machine} and transfer the file
using the default method.  @xref{Default Method}.

Some examples of @value{tramp} filenames are shown below.

@table @file
@item @trampfn{, , melancholia, .emacs}
Edit the file @file{.emacs} in your home directory on the machine
@code{melancholia}.

@item @trampfn{, , melancholia.danann.net, .emacs}
This edits the same file, using the fully qualified domain name of
the machine.

@item @trampfn{, , melancholia, ~/.emacs}
This also edits the same file --- the @file{~} is expanded to your
home directory on the remote machine, just like it is locally.

@item @trampfn{, , melancholia, ~daniel/.emacs}
This edits the file @file{.emacs} in the home directory of the user
@code{daniel} on the machine @code{melancholia}.  The @file{~<user>}
construct is expanded to the home directory of that user on the remote
machine.

@item @trampfn{, , melancholia, /etc/squid.conf}
This edits the file @file{/etc/squid.conf} on the machine
@code{melancholia}.

@end table

Unless you specify a different name to use, @value{tramp} will use the
current local user name as the remote user name to log in with.  If you
need to log in as a different user, you can specify the user name as
part of the filename.

To log in to the remote machine as a specific user, you use the syntax
@file{@trampfn{, user, machine, path/to.file}}.  That means that
connecting to @code{melancholia} as @code{daniel} and editing
@file{.emacs} in your home directory you would specify
@file{@trampfn{, daniel, melancholia, .emacs}}.

It is also possible to specify other file transfer methods
(@pxref{Inline methods}, @pxref{External transfer methods}) as part of
the filename.
@ifset emacs
This is done by putting the method before the user and host name, as
in @file{@value{prefix}@var{method}@value{postfixhop}} (Note the
trailing colon).
@end ifset
@ifset xemacs
This is done by replacing the initial @file{@value{prefix}} with
@file{@value{prefix}<method>@value{postfixhop}}.  (Note the trailing
slash!).
@end ifset
The user, machine and file specification remain the same.

So, to connect to the machine @code{melancholia} as @code{daniel},
using the @option{ssh} method to transfer files, and edit
@file{.emacs} in my home directory I would specify the filename
@file{@trampfn{ssh, daniel, melancholia, .emacs}}.


@node Alternative Syntax
@section URL-like filename syntax
@cindex filename syntax
@cindex filename examples

Additionally to the syntax described in the previous chapter, it is
possible to use a URL-like syntax for @value{tramp}.  This can be
switched on by customizing the variable @code{tramp-syntax}.  Please
note that this feature is experimental for the time being.

The variable @code{tramp-syntax} must be set before requiring @value{tramp}:

@lisp
(setq tramp-syntax 'url)
(require 'tramp)
@end lisp

Then, a @value{tramp} filename would look like this:
@file{/@var{method}://@var{user}@@@var{machine}:@var{port}/@var{path/to.file}}.
@file{/@var{method}://} is mandatory, all other parts are optional.
@file{:@var{port}} is useful for methods only who support this.

The last example from the previous section would look like this:
@file{/ssh://daniel@@melancholia/.emacs}.

For the time being, @code{tramp-syntax} can have the following values:

@itemize @w{}
@ifset emacs
@item @code{ftp} -- That is the default syntax
@item @code{url} -- URL-like syntax
@end ifset
@ifset xemacs
@item @code{sep} -- That is the default syntax
@item @code{url} -- URL-like syntax
@item @code{ftp} -- EFS-like syntax
@end ifset
@end itemize


@node Filename completion
@section Filename completion
@cindex filename completion

Filename completion works with @value{tramp} for completion of method
names, of user names and of machine names as well as for completion of
file names on remote machines.
@ifset emacs
In order to enable this, Partial Completion mode must be set on.
@ifinfo
@xref{Completion Options, , , @value{emacsdir}}.
@end ifinfo
@end ifset

If you, for example, type @kbd{C-x C-f @value{prefix}t
@key{TAB}}, @value{tramp} might give you as result the choice for

@example
@ifset emacs
@value{prefixhop}telnet@value{postfixhop}                        tmp/
@value{prefixhop}toto@value{postfix}
@end ifset
@ifset xemacs
@value{prefixhop}telnet@value{postfixhop}                        @value{prefixhop}toto@value{postfix}
@end ifset
@end example

@samp{@value{prefixhop}telnet@value{postfixhop}}
is a possible completion for the respective method,
@ifset emacs
@samp{tmp/} stands for the directory @file{/tmp} on your local
machine,
@end ifset
and @samp{@value{prefixhop}toto@value{postfix}}
might be a host @value{tramp} has detected in your @file{~/.ssh/known_hosts}
file (given you're using default method @option{ssh}).

If you go on to type @kbd{e @key{TAB}}, the minibuffer is completed to
@samp{@value{prefix}telnet@value{postfixhop}}.
Next @kbd{@key{TAB}} brings you all machine names @value{tramp} detects in
your @file{/etc/hosts} file, let's say

@example
@trampfn{telnet, , 127.0.0.1,}             @trampfn{telnet, , 192.168.0.1,}
@trampfn{telnet, , localhost,}             @trampfn{telnet, , melancholia.danann.net,}
@trampfn{telnet, , melancholia,}
@end example

Now you can choose the desired machine, and you can continue to
complete file names on that machine.

If the configuration files (@pxref{Customizing Completion}), which
@value{tramp} uses for analysis of completion, offer user names, those user
names will be taken into account as well.

Remote machines, which have been visited in the past and kept
persistently (@pxref{Connection caching}), will be offered too.

Once the remote machine identification is completed, it comes to
filename completion on the remote host.  This works pretty much like
for files on the local host, with the exception that minibuffer
killing via a double-slash works only on the filename part, except
that filename part starts with @file{//}.
@ifset emacs
A triple-slash stands for the default behavior.
@end ifset
@ifinfo
@xref{Minibuffer File, , , @value{emacsdir}}.
@end ifinfo

@noindent
Example:

@example
@ifset emacs
@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin//etc} @key{TAB}}
     @print{} @trampfn{telnet, , melancholia, /etc}

@kbd{C-x C-f @trampfn{telnet, , melancholia, //etc} @key{TAB}}
     @print{} /etc

@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin///etc} @key{TAB}}
     @print{} /etc
@end ifset

@ifset xemacs
@kbd{C-x C-f @trampfn{telnet, , melancholia, /usr/local/bin//}}
     @print{} @trampfn{telnet, , melancholia, /}

@kbd{C-x C-f @trampfn{telnet, , melancholia, //}}
     @print{} /
@end ifset
@end example

A remote directory might have changed its contents out of
@value{emacsname} control, for example by creation or deletion of
files by other processes.  Therefore, during filename completion the
remote directory contents is reread regularly in order to detect such
changes, which would be invisible otherwise (@pxref{Connection caching}).

@defopt tramp-completion-reread-directory-timeout
This variable defines the number of seconds since last remote command
before rereading a directory contents.  A value of 0 would require an
immediate reread during filename completion, @code{nil} means to use
always cached values for the directory contents.
@end defopt


@node Remote processes
@section Integration with other @value{emacsname} packages.
@cindex compile
@cindex recompile

@value{tramp} supports running processes on a remote host.  This
allows to exploit @value{emacsname} packages without modification for
remote file names.  It does not work for the @option{ftp} and
@option{smb} methods.

Remote processes are started when a corresponding command is executed
from a buffer belonging to a remote file or directory.  Up to now, the
packages @file{compile.el} (commands like @code{compile} and
@code{grep}) and @file{gud.el} (@code{gdb} or @code{perldb}) have been
integrated.  Integration of further packages is planned, any help for
this is welcome!

When your program is not found in the default search path
@value{tramp} sets on the remote machine, you should either use an
absolute path, or extend @code{tramp-remote-path} (see @ref{Remote
Programs}):

@lisp
(add-to-list 'tramp-remote-path "~/bin")
(add-to-list 'tramp-remote-path "/appli/pub/bin")
@end lisp

The environment for your program can be adapted by customizing
@code{tramp-remote-process-environment}.  This variable is a list of
strings.  It is structured like @code{process-environment}.  Each
element is a string of the form ENVVARNAME=VALUE.  An entry
ENVVARNAME= disables the corresponding environment variable, which
might have been set in your init file like @file{~/.profile}.

@noindent
Adding an entry can be performed via @code{add-to-list}:

@lisp
(add-to-list 'tramp-remote-process-environment "JAVA_HOME=/opt/java")
@end lisp

Changing or removing an existing entry is not encouraged.  The default
values are chosen for proper @value{tramp} work.  Nevertheless, if for
example a paranoid system administrator disallows changing the
@var{$HISTORY} environment variable, you can customize
@code{tramp-remote-process-environment}, or you can apply the
following code in your @file{.emacs}:

@lisp
(let ((process-environment tramp-remote-process-environment))
  (setenv "HISTORY" nil)
  (setq tramp-remote-process-environment process-environment))
@end lisp

If you use other @value{emacsname} packages which do not run
out-of-the-box on a remote host, please let us know.  We will try to
integrate them as well.  @xref{Bug Reports}.


@subsection Running shell-command on a remote host
@cindex shell-command

@code{shell-command} allows to execute commands in a shell, either
synchronously, either asynchronously.  This works also on remote
hosts.  Example:

@example
@kbd{C-x C-f @trampfn{sudo, , , } @key{RET}}
@kbd{M-! tail -f /var/log/syslog.log & @key{RET}}
@end example

You will see the buffer @file{*Async Shell Command*}, containing the
continous output of the @command{tail} command.


@subsection Running eshell on a remote host
@cindex eshell

@value{tramp} is integrated into @file{eshell.el}.  That is, you can
open an interactive shell on your remote host, and run commands there.
After you have started @code{eshell}, you could perform commands like
this:

@example
@b{~ $} cd @trampfn{sudo, , , /etc} @key{RET}
@b{@trampfn{sudo, root, host, /etc} $} hostname @key{RET}
host
@b{@trampfn{sudo, root, host, /etc} $} id @key{RET}
uid=0(root) gid=0(root) groups=0(root)
@b{@trampfn{sudo, root, host, /etc} $} find-file shadow @key{RET}
#<buffer shadow>
@b{@trampfn{sudo, root, host, /etc} $}
@end example


@anchor{Running a debugger on a remote host}
@subsection Running a debugger on a remote host
@cindex gud
@cindex gdb
@cindex perldb

@file{gud.el} offers an unified interface to several symbolic
debuggers
@ifset emacs
@ifinfo
(@ref{Debuggers, , , @value{emacsdir}}).
@end ifinfo
@end ifset
With @value{tramp}, it is possible to debug programs on
remote hosts.  You can call @code{gdb} with a remote file name:

@example
@kbd{M-x gdb @key{RET}}
@b{Run gdb (like this):} gdb --annotate=3 @trampfn{ssh, , host, ~/myprog} @key{RET}
@end example

The file name can also be relative to a remote default directory.
Given you are in a buffer that belongs to the remote directory
@trampfn{ssh, , host, /home/user}, you could call

@example
@kbd{M-x perldb @key{RET}}
@b{Run perldb (like this):} perl -d myprog.pl @key{RET}
@end example

It is not possible to use just the absolute local part of a remote
file name as program to debug, like @kbd{perl -d
/home/user/myprog.pl}, though.

Arguments of the program to be debugged are taken literally.  That
means, file names as arguments must be given as ordinary relative or
absolute file names, without any remote specification.


@node Cleanup remote connections
@section Cleanup remote connections.
@cindex cleanup

Sometimes it is useful to cleanup remote connections.  The following
commands support this.

@deffn Command tramp-cleanup-connection vec
This command flushes all connection related objects.  @option{vec} is
the internal representation of a remote connection.  Called
interactively, the command offers all active remote connections in the
minibuffer as remote file name prefix like @file{@trampfn{method,
user, host, }}.  The cleanup includes password cache (@pxref{Password
handling}), file cache, connection cache (@pxref{Connection caching}),
connection buffers.
@end deffn

@deffn Command tramp-cleanup-all-connections
This command flushes objects for all active remote connections.  The
same objects are removed as in @code{tramp-cleanup-connection}.
@end deffn

@deffn Command tramp-cleanup-all-buffers
Like in @code{tramp-cleanup-all-connections}, all remote connections
are cleaned up.  Additionally all buffers, which are related to a
remote connection, are killed.
@end deffn


@node Bug Reports
@chapter Reporting Bugs and Problems
@cindex bug reports

Bugs and problems with @value{tramp} are actively worked on by the
development team.  Feature requests and suggestions are also more than
welcome.

The @value{tramp} mailing list is a great place to get information on
working with @value{tramp}, solving problems and general discussion
and advice on topics relating to the package.  It is moderated so
non-subscribers can post but messages will be delayed, possibly up to
48 hours (or longer in case of holidays), until the moderator approves
your message.

The mailing list is at @email{tramp-devel@@gnu.org}.  Messages sent to
this address go to all the subscribers.  This is @emph{not} the address
to send subscription requests to.

Subscribing to the list is performed via
@uref{http://lists.gnu.org/mailman/listinfo/tramp-devel/,
the @value{tramp} Mail Subscription Page}.

@findex tramp-bug
To report a bug in @value{tramp}, you should execute @kbd{M-x
tramp-bug}.  This will automatically generate a buffer with the details
of your system and @value{tramp} version.

When submitting a bug report, please try to describe in excruciating
detail the steps required to reproduce the problem, the setup of the
remote machine and any special conditions that exist.  You should also
check that your problem is not described already in @xref{Frequently
Asked Questions}.

If you can identify a minimal test case that reproduces the problem,
include that with your bug report.  This will make it much easier for
the development team to analyze and correct the problem.

Before reporting the bug, you should set the verbosity level to 6
(@pxref{Traces and Profiles, Traces}) in the @file{~/.emacs} file and
repeat the bug.  Then, include the contents of the @file{*tramp/foo*}
and @file{*debug tramp/foo*} buffers in your bug report.  A verbosity
level greater than 6 will produce a very huge debug buffer, which is
mostly not necessary for the analysis.

Please be aware that, with a verbosity level of 6 or greater, the
contents of files and directories will be included in the debug
buffer.  Passwords you've typed will never be included there.


@node Frequently Asked Questions
@chapter Frequently Asked Questions
@cindex frequently asked questions
@cindex FAQ

@itemize @bullet
@item
Where can I get the latest @value{tramp}?

@value{tramp} is available under the URL below.

@noindent
@uref{ftp://ftp.gnu.org/gnu/tramp/}

@noindent
There is also a Savannah project page.

@noindent
@uref{http://savannah.gnu.org/projects/tramp/}


@item
Which systems does it work on?

The package has been used successfully on GNU Emacs 21, GNU Emacs 22
and XEmacs 21 (starting with 21.4).  Gateway methods are supported for
GNU Emacs 22 only.

The package was intended to work on Unix, and it really expects a
Unix-like system on the remote end (except the @option{smb} method),
but some people seemed to have some success getting it to work on MS
Windows NT/2000/XP @value{emacsname}.

There is some informations on @value{tramp} on NT at the following URL;
many thanks to Joe Stoy for providing the information:
@uref{ftp://ftp.comlab.ox.ac.uk/tmp/Joe.Stoy/}

@c The link is broken.  I've contacted Tom for clarification.  Michael.
@ignore
The above mostly contains patches to old ssh versions; Tom Roche has a
Web page with instructions:
@uref{http://www4.ncsu.edu/~tlroche/plinkTramp.html}
@end ignore

@item
How could I speed up @value{tramp}?

In the backstage, @value{tramp} needs a lot of operations on the
remote host.  The time for transferring data from and to the remote
host as well as the time needed to perform the operations there count.
In order to speed up @value{tramp}, one could either try to avoid some
of the operations, or one could try to improve their performance.

Use an external transfer method, like @option{scpc}.

Use caching.  This is already enabled by default.  Information about
the remote host as well as the remote files are cached for reuse.  The
information about remote hosts is kept in the file specified in
@code{tramp-persistency-file-name}.  Keep this file.

Disable version control.  If you access remote files which are not
under version control, a lot of check operations can be avoided by
disabling VC.  This can be achieved by

@lisp
(setq vc-handled-backends nil)
@end lisp

Disable excessive traces.  The default trace level of @value{tramp},
defined in the variable @code{tramp-verbose}, is 3.  You should
increase this level only temporarily, hunting bugs.


@item
@value{tramp} does not connect to the remote host

When @value{tramp} does not connect to the remote host, there are two
reasons heading the bug mailing list:

@itemize @minus

@item
Unknown characters in the prompt

@value{tramp} needs to recognize the prompt on the remote machine
after execution any command.  This is not possible, when the prompt
contains unknown characters like escape sequences for coloring.  This
should be avoided on the remote side.  @xref{Remote shell setup}. for
setting the regular expression detecting the prompt.

You can check your settings after an unsuccessful connection by
switching to the @value{tramp} connection buffer @file{*tramp/foo*},
setting the cursor at the top of the buffer, and applying the expression

@example
@kbd{M-: (re-search-forward (concat tramp-shell-prompt-pattern "$"))}
@end example

If it fails, or the cursor is not moved at the end of the buffer, your
prompt is not recognised correctly.

A special problem is the zsh, which uses left-hand side and right-hand
side prompts in parallel.  Therefore, it is necessary to disable the
zsh line editor on the remote host.  You shall add to @file{~/.zshrc}
the following command:

@example
[ $TERM = "dumb" ] && unsetopt zle && PS1='$ '
@end example


@item
@value{tramp} doesn't transfer strings with more than 500 characters
correctly

On some few systems, the implementation of @code{process-send-string}
seems to be broken for longer strings.  It is reported for HP-UX,
FreeBSD and Tru64 Unix, for example.  This case, you should customize
the variable @code{tramp-chunksize} to 500.  For a description how to
determine whether this is necessary see the documentation of
@code{tramp-chunksize}.

Additionally, it will be useful to set @code{file-precious-flag} to
@code{t} for @value{tramp} files.  Then the file contents will be
written into a temporary file first, which is checked for correct
checksum.
@ifinfo
@pxref{Saving Buffers, , , elisp}
@end ifinfo

@lisp
(add-hook
 'find-file-hooks
 '(lambda ()
    (when (file-remote-p default-directory)
      (set (make-local-variable 'file-precious-flag) t))))
@end lisp

@end itemize


@item
File name completion does not work with @value{tramp}

When you log in to the remote machine, do you see the output of
@command{ls} in color? If so, this may be the cause of your problems.

@command{ls} outputs @acronym{ANSI} escape sequences that your terminal
emulator interprets to set the colors.  These escape sequences will
confuse @value{tramp} however.

In your @file{.bashrc}, @file{.profile} or equivalent on the remote
machine you probably have an alias configured that adds the option
@option{--color=yes} or @option{--color=auto}.

You should remove that alias and ensure that a new login @emph{does not}
display the output of @command{ls} in color.  If you still cannot use
filename completion, report a bug to the @value{tramp} developers.


@item
File name completion does not work in large directories

@value{tramp} uses globbing for some operations.  (Globbing means to use the
shell to expand wildcards such as `*.c'.)  This might create long
command lines, especially in directories with many files.  Some shells
choke on long command lines, or don't cope well with the globbing
itself.

If you have a large directory on the remote end, you may wish to execute
a command like @samp{ls -d * ..?* > /dev/null} and see if it hangs.
Note that you must first start the right shell, which might be
@command{/bin/sh}, @command{ksh} or @command{bash}, depending on which
of those supports tilde expansion.


@item
How can I get notified when @value{tramp} file transfers are complete?

The following snippet can be put in your @file{~/.emacs} file.  It
makes @value{emacsname} beep after reading from or writing to the
remote host.

@lisp
(defadvice tramp-handle-write-region
  (after tramp-write-beep-advice activate)
  "Make tramp beep after writing a file."
  (interactive)
  (beep))

(defadvice tramp-handle-do-copy-or-rename-file
  (after tramp-copy-beep-advice activate)
  "Make tramp beep after copying a file."
  (interactive)
  (beep))

(defadvice tramp-handle-insert-file-contents
  (after tramp-insert-beep-advice activate)
  "Make tramp beep after inserting a file."
  (interactive)
  (beep))
@end lisp


@ifset emacs
@item
I'ld like to get a Visual Warning when working in a sudo:ed context

When you are working with @samp{root} privileges, it might be useful
to get an indication in the buffer's modeline.  The following code,
tested with @value{emacsname} 22.1, does the job.  You should put it
into your @file{~/.emacs}:

@lisp
(defun my-mode-line-function ()
  (when (string-match "^/su\\(do\\)?:" default-directory)
    (setq mode-line-format
          (format-mode-line mode-line-format 'font-lock-warning-face))))

(add-hook 'find-file-hooks 'my-mode-line-function)
(add-hook 'dired-mode-hook 'my-mode-line-function)
@end lisp
@end ifset


@ifset emacs
@item
I'ld like to see a host indication in the mode line when I'm remote

The following code has been tested with @value{emacsname} 22.1.  You
should put it into your @file{~/.emacs}:

@lisp
(defconst my-mode-line-buffer-identification
  (list
   '(:eval
     (let ((host-name
            (if (file-remote-p default-directory)
                (tramp-file-name-host
                 (tramp-dissect-file-name default-directory))
              (system-name))))
       (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name)
           (substring host-name 0 (match-beginning 1))
         host-name)))
   ": %12b"))

(setq-default
 mode-line-buffer-identification
 my-mode-line-buffer-identification)

(add-hook
 'dired-mode-hook
 '(lambda ()
    (setq
     mode-line-buffer-identification
     my-mode-line-buffer-identification)))
@end lisp

Since @value{emacsname} 23.1, the mode line contains an indication if
@code{default-directory} for the current buffer is on a remote host.
The corresponding tooltip includes the name of that host.  If you
still want the host name as part of the mode line, you can use the
example above, but the @code{:eval} clause can be simplified:

@lisp
   '(:eval
     (let ((host-name
            (or (file-remote-p default-directory 'host)
                (system-name))))
       (if (string-match "^[^0-9][^.]*\\(\\..*\\)" host-name)
           (substring host-name 0 (match-beginning 1))
         host-name)))
@end lisp
@end ifset


@ifset emacs
@item
My remote host does not understand default directory listing options

@value{emacsname} computes the @command{dired} options depending on
the local host you are working.  If your @command{ls} command on the
remote host does not understand those options, you can change them
like this:

@lisp
(add-hook
 'dired-before-readin-hook
 '(lambda ()
    (when (file-remote-p default-directory)
      (setq dired-actual-switches "-al"))))
@end lisp
@end ifset


@item
There's this @file{~/.sh_history} file on the remote host which keeps
growing and growing.  What's that?

Sometimes, @value{tramp} starts @command{ksh} on the remote host for
tilde expansion.  Maybe @command{ksh} saves the history by default.
@value{tramp} tries to turn off saving the history, but maybe you have
to help.  For example, you could put this in your @file{.kshrc}:

@example
if [ -f $HOME/.sh_history ] ; then
   /bin/rm $HOME/.sh_history
fi
if [ "$@{HISTFILE-unset@}" != "unset" ] ; then
   unset HISTFILE
fi
if [ "$@{HISTSIZE-unset@}" != "unset" ] ; then
   unset HISTSIZE
fi
@end example


@item There are longish file names to type.  How to shorten this?

Let's say you need regularly access to @file{@trampfn{ssh, news,
news.my.domain, /opt/news/etc}}, which is boring to type again and
again.  The following approaches can be mixed:

@enumerate

@item Use default values for method and user name:

You can define default methods and user names for hosts,
(@pxref{Default Method}, @pxref{Default User}):

@lisp
(setq tramp-default-method "ssh"
      tramp-default-user "news")
@end lisp

The file name left to type would be
@kbd{C-x C-f @trampfn{, , news.my.domain, /opt/news/etc}}.

Note, that there are some useful settings already.  Accessing your
local host as @samp{root} user, is possible just by @kbd{C-x C-f
@trampfn{su, , ,}}.

@item Use configuration possibilities of your method:

Several connection methods (i.e. the programs used) offer powerful
configuration possibilities (@pxref{Customizing Completion}).  In the
given case, this could be @file{~/.ssh/config}:

@example
Host xy
     HostName news.my.domain
     User news
@end example

The file name left to type would be @kbd{C-x C-f @trampfn{ssh, , xy,
/opt/news/etc}}.  Depending on files in your directories, it is even
possible to complete the host name with @kbd{C-x C-f
@value{prefix}ssh@value{postfixhop}x @key{TAB}}.

@item Use environment variables:

File names typed in the minibuffer can be expanded by environment
variables.  You can set them outside @value{emacsname}, or even with
Lisp:

@lisp
(setenv "xy" "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}")
@end lisp

Then you need simply to type @kbd{C-x C-f $xy @key{RET}}, and here you
are.  The disadvantage is, that you cannot edit the file name, because
environment variables are not expanded during editing in the
minibuffer.

@item Define own keys:

You can define your own key sequences in @value{emacsname}, which can
be used instead of @kbd{C-x C-f}:

@lisp
(global-set-key
 [(control x) (control y)]
 (lambda ()
   (interactive)
   (find-file
    (read-file-name
     "Find Tramp file: "
     "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}"))))
@end lisp

Simply typing @kbd{C-x C-y} would initialize the minibuffer for
editing with your beloved file name.

See also @uref{http://www.emacswiki.org/cgi-bin/wiki/TrampMode, the
Emacs Wiki} for a more comprehensive example.

@item Define own abbreviation (1):

It is possible to define an own abbreviation list for expanding file
names:

@lisp
(add-to-list
 'directory-abbrev-alist
 '("^/xy" . "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}"))
@end lisp

This shortens the file openening command to @kbd{C-x C-f /xy
@key{RET}}.  The disadvantage is, again, that you cannot edit the file
name, because the expansion happens after entering the file name only.

@item Define own abbreviation (2):

The @code{abbrev-mode} gives more flexibility for editing the
minibuffer:

@lisp
(define-abbrev-table 'my-tramp-abbrev-table
  '(("xy" "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}")))

(add-hook
 'minibuffer-setup-hook
 '(lambda ()
    (abbrev-mode 1)
    (setq local-abbrev-table my-tramp-abbrev-table)))

(defadvice minibuffer-complete
  (before my-minibuffer-complete activate)
  (expand-abbrev))

;; If you use partial-completion-mode
(defadvice PC-do-completion
  (before my-PC-do-completion activate)
  (expand-abbrev))
@end lisp

After entering @kbd{C-x C-f xy @key{TAB}}, the minibuffer is
expanded, and you can continue editing.

@item Use bookmarks:

Bookmarks can be used to visit Tramp files or directories.
@ifinfo
@pxref{Bookmarks, , , @value{emacsdir}}
@end ifinfo

When you have opened @file{@trampfn{ssh, news, news.my.domain,
/opt/news/etc/}}, you should save the bookmark via
@ifset emacs
@kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{set}}.
@end ifset
@ifset xemacs
@kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{set}}.
@end ifset

Later on, you can always navigate to that bookmark via
@ifset emacs
@kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{jump}}.
@end ifset
@ifset xemacs
@kbd{@key{menu-bar} @key{view} @key{bookmarks} @key{jump}}.
@end ifset

@item Use recent files:

@ifset emacs
@file{recentf}
@end ifset
@ifset xemacs
@file{recent-files}
@end ifset
remembers visited places.
@ifinfo
@ifset emacs
@pxref{File Conveniences, , , @value{emacsdir}}
@end ifset
@ifset xemacs
@pxref{recent-files, , , edit-utils}
@end ifset
@end ifinfo

You could keep remote file names in the recent list without checking
their readability through a remote access:

@lisp
@ifset emacs
(recentf-mode 1)
@end ifset
@ifset xemacs
(recent-files-initialize)
(add-hook
 'find-file-hooks
 (lambda ()
   (when (file-remote-p (buffer-file-name))
     (recent-files-make-permanent)))
 'append)
@end ifset
@end lisp

The list of files opened recently is reachable via
@ifset emacs
@kbd{@key{menu-bar} @key{file} @key{Open Recent}}.
@end ifset
@ifset xemacs
@kbd{@key{menu-bar} @key{Recent Files}}.
@end ifset

@ifset emacs
@item Use filecache:

@file{filecache} remembers visited places.  Add the directory into
the cache:

@lisp
(eval-after-load "filecache"
  '(file-cache-add-directory
    "@trampfn{ssh, news, news.my.domain, /opt/news/etc/}"))
@end lisp

Whenever you want to load a file, you can enter @kbd{C-x C-f
C-@key{TAB}} in the minibuffer.  The completion is done for the given
directory.
@end ifset

@ifset emacs
@item Use bbdb:

@file{bbdb} has a built-in feature for @value{ftppackagename} files,
which works also for @value{tramp}.
@ifinfo
@pxref{bbdb-ftp, Storing FTP sites in the BBDB, , bbdb}
@end ifinfo

You need to load @file{bbdb}:

@lisp
(require 'bbdb)
(bbdb-initialize)
@end lisp

Then you can create a BBDB entry via @kbd{M-x bbdb-create-ftp-site}.
Because BBDB is not prepared for @value{tramp} syntax, you must
specify a method together with the user name, when needed. Example:

@example
@kbd{M-x bbdb-create-ftp-site @key{RET}}
@b{Ftp Site:} news.my.domain @key{RET}
@b{Ftp Directory:} /opt/news/etc/ @key{RET}
@b{Ftp Username:} ssh@value{postfixhop}news @key{RET}
@b{Company:} @key{RET}
@b{Additional Comments:} @key{RET}
@end example

When you have opened your BBDB buffer, you can access such an entry by
pressing the key @key{F}.
@end ifset

@end enumerate

I would like to thank all @value{tramp} users, who have contributed to
the different recipes!


@item
How can I disable @value{tramp}?

Shame on you, why did you read until now?

@itemize @minus

@item
@ifset emacs
If you just want to have @value{ftppackagename} as default remote
files access package, you should apply the following code:

@lisp
(setq tramp-default-method "ftp")
@end lisp
@end ifset

@item
In order to disable
@ifset emacs
@value{tramp} (and @value{ftppackagename}),
@end ifset
@ifset xemacs
@value{tramp},
@end ifset
you must set @code{tramp-mode} to @code{nil}:

@lisp
(setq tramp-mode nil)
@end lisp

@item
Unloading @value{tramp} can be achieved by applying @kbd{M-x
tramp-unload-tramp}.
@ifset emacs
This resets also the @value{ftppackagename} plugins.
@end ifset
@end itemize
@end itemize


@c For the developer
@node Version Control
@chapter The inner workings of remote version control
@cindex Version Control

Unlike @value{ftppackagename}, @value{tramp} has full shell access to the
remote machine.  This makes it possible to provide version control for
files accessed under @value{tramp}.

The actual version control binaries must be installed on the remote
machine, accessible in the directories specified in
@code{tramp-remote-path}.

This transparent integration with the version control systems is one of
the most valuable features provided by @value{tramp}, but it is far from perfect.
Work is ongoing to improve the transparency of the system.

@menu
* Version Controlled Files::    Determining if a file is under version control.
* Remote Commands::             Executing the version control commands on the remote machine.
* Changed workfiles::           Detecting if the working file has changed.
* Checking out files::          Bringing the workfile out of the repository.
* Miscellaneous Version Control::  Things related to Version Control that don't fit elsewhere.
@end menu


@node Version Controlled Files
@section Determining if a file is under version control

The VC package uses the existence of on-disk revision control master
files to determine if a given file is under revision control.  These file
tests happen on the remote machine through the standard @value{tramp} mechanisms.


@node Remote Commands
@section Executing the version control commands on the remote machine

There are no hooks provided by VC to allow intercepting of the version
control command execution.  The calls occur through the
@code{call-process} mechanism, a function that is somewhat more
efficient than the @code{shell-command} function but that does not
provide hooks for remote execution of commands.

To work around this, the functions @code{vc-do-command} and
@code{vc-simple-command} have been advised to intercept requests for
operations on files accessed via @value{tramp}.

In the case of a remote file, the @code{shell-command} interface is
used, with some wrapper code, to provide the same functionality on the
remote machine as would be seen on the local machine.


@node Changed workfiles
@section Detecting if the working file has changed

As there is currently no way to get access to the mtime of a file on a
remote machine in a portable way, the @code{vc-workfile-unchanged-p}
function is advised to call an @value{tramp} specific function for remote files.

The @code{tramp-vc-workfile-unchanged-p} function uses the functioning VC
diff functionality to determine if any changes have occurred between the
workfile and the version control master.

This requires that a shell command be executed remotely, a process that
is notably heavier-weight than the mtime comparison used for local
files.  Unfortunately, unless a portable solution to the issue is found,
this will remain the cost of remote version control.


@node Checking out files
@section Bringing the workfile out of the repository

VC will, by default, check for remote files and refuse to act on them
when checking out files from the repository.  To work around this
problem, the function @code{vc-checkout} knows about @value{tramp} files and
allows version control to occur.


@node Miscellaneous Version Control
@section Things related to Version Control that don't fit elsewhere

Minor implementation details, &c.

@menu
* Remote File Ownership::       How VC determines who owns a workfile.
* Back-end Versions::           How VC determines what release your RCS is.
@end menu


@node Remote File Ownership
@subsection How VC determines who owns a workfile

@value{emacsname} provides the @code{user-login-name} function to
return the login name of the current user as well as mapping from
arbitrary user id values back to login names.  The VC code uses this
functionality to map from the uid of the owner of a workfile to the
login name in some circumstances.

This will not, for obvious reasons, work if the remote system has a
different set of logins.  As such, it is necessary to delegate to the
remote machine the job of determining the login name associated with a
uid.

Unfortunately, with the profusion of distributed management systems such
as @code{NIS}, @code{NIS+} and @code{NetInfo}, there is no simple,
reliable and portable method for performing this mapping.

Thankfully, the only place in the VC code that depends on the mapping of
a uid to a login name is the @code{vc-file-owner} function.  This returns
the login of the owner of the file as a string.

This function has been advised to use the output of @command{ls} on the
remote machine to determine the login name, delegating the problem of
mapping the uid to the login to the remote system which should know more
about it than I do.


@node Back-end Versions
@subsection How VC determines what release your RCS is

VC needs to know what release your revision control binaries you are
running as not all features VC supports are available with older
versions of @command{rcs(1)}, @command{cvs(1)} or @command{sccs(1)}.

The default implementation of VC determines this value the first time it
is needed and then stores the value globally to avoid the overhead of
executing a process and parsing its output each time the information is
needed.

Unfortunately, life is not quite so easy when remote version control
comes into the picture.  Each remote machine may have a different version
of the version control tools and, while this is painful, we need to
ensure that unavailable features are not used remotely.

To resolve this issue, @value{tramp} currently takes the sledgehammer
approach of making the release values of the revision control tools
local to each @value{tramp} buffer, forcing VC to determine these values
again each time a new file is visited.

This has, quite obviously, some performance implications.  Thankfully,
most of the common operations performed by VC do not actually require
that the remote version be known.  This makes the problem far less
apparent.

Eventually these values will be captured by @value{tramp} on a system by
system basis and the results cached to improve performance.


@node Files directories and localnames
@chapter How file names, directories and localnames are mangled and managed.

@menu
* Localname deconstruction::    Breaking a localname into its components.
@ifset emacs
* External packages::           Integration with external Lisp packages.
@end ifset
@end menu


@node Localname deconstruction
@section Breaking a localname into its components.

@value{tramp} file names are somewhat different, obviously, to ordinary file
names.  As such, the lisp functions @code{file-name-directory} and
@code{file-name-nondirectory} are overridden within the @value{tramp}
package.

Their replacements are reasonably simplistic in their approach.  They
dissect the filename, call the original handler on the localname and
then rebuild the @value{tramp} file name with the result.

This allows the platform specific hacks in the original handlers to take
effect while preserving the @value{tramp} file name information.


@ifset emacs
@node External packages
@section Integration with external Lisp packages.

While reading filenames in the minibuffer, @value{tramp} must decide
whether it completes possible incomplete filenames, or not.  Imagine
there is the following situation: You have typed @kbd{C-x C-f
@value{prefix}ssh@value{postfixhop} @key{TAB}}.  @value{tramp} cannot
know, whether @option{ssh} is a method or a host name.  It checks
therefore the last input character you have typed.  If this is
@key{TAB}, @key{SPACE} or @kbd{?}, @value{tramp} assumes that you are
still in filename completion, and it does not connect to the possible
remote host @option{ssh}.

@vindex tramp-completion-mode
External packages, which use other characters for completing filenames
in the minibuffer, must signal this to @value{tramp}.  For this case,
the variable @code{tramp-completion-mode} can be bound temporarily to
a non-nil value.

@lisp
(let ((tramp-completion-mode t))
  ...)
@end lisp
@end ifset


@node Traces and Profiles
@chapter How to Customize Traces

All @value{tramp} messages are raised with a verbosity level.  The
verbosity level can be any number between 0 and 10.  Only messages with
a verbosity level less than or equal to @code{tramp-verbose} are
displayed.

The verbosity levels are

          @w{ 0}  silent (no @value{tramp} messages at all)
@*@indent @w{ 1}  errors
@*@indent @w{ 2}  warnings
@*@indent @w{ 3}  connection to remote hosts (default verbosity)
@*@indent @w{ 4}  activities
@*@indent @w{ 5}  internal
@*@indent @w{ 6}  sent and received strings
@*@indent @w{ 7}  file caching
@*@indent @w{ 8}  connection properties
@*@indent @w{10}  traces (huge)

When @code{tramp-verbose} is greater than or equal to 4, the messages
are also written into a @value{tramp} debug buffer.  This debug buffer
is useful for analysing problems; sending a @value{tramp} bug report
should be done with @code{tramp-verbose} set to a verbosity level of at
least 6 (@pxref{Bug Reports}).

The debug buffer is in
@ifinfo
@ref{Outline Mode, , , @value{emacsdir}}.
@end ifinfo
@ifnotinfo
Outline Mode.
@end ifnotinfo
That means, you can change the level of messages to be viewed.  If you
want, for example, see only messages up to verbosity level 5, you must
enter @kbd{C-u 6 C-c C-q}.
@ifinfo
Other keys for navigating are described in
@ref{Outline Visibility, , , @value{emacsdir}}.
@end ifinfo

@value{tramp} errors are handled internally in order to raise the
verbosity level 1 messages.  When you want to get a Lisp backtrace in
case of an error, you need to set both

@lisp
(setq debug-on-error t
      debug-on-signal t)
@end lisp

Sometimes, it might be even necessary to step through @value{tramp}
function call traces.  Such traces are enabled by the following code:

@lisp
(require 'tramp)
(require 'trace)
(dolist (elt (all-completions "tramp-" obarray 'functionp))
  (trace-function-background (intern elt)))
(untrace-function 'tramp-read-passwd)
(untrace-function 'tramp-gw-basic-authentication)
@end lisp

The function call traces are inserted in the buffer
@file{*trace-output*}.  @code{tramp-read-passwd} and
@code{tramp-gw-basic-authentication} shall be disabled when the
function call traces are added to @value{tramp}, because both
functions return password strings, which should not be distributed.


@node Issues
@chapter Debatable Issues and What Was Decided

@itemize @bullet
@item The uuencode method does not always work.

Due to the design of @value{tramp}, the encoding and decoding programs
need to read from stdin and write to stdout.  On some systems,
@command{uudecode -o -} will read stdin and write the decoded file to
stdout, on other systems @command{uudecode -p} does the same thing.
But some systems have uudecode implementations which cannot do this at
all---it is not possible to call these uudecode implementations with
suitable parameters so that they write to stdout.

Of course, this could be circumvented: the @code{begin foo 644} line
could be rewritten to put in some temporary file name, then
@command{uudecode} could be called, then the temp file could be
printed and deleted.

But I have decided that this is too fragile to reliably work, so on some
systems you'll have to do without the uuencode methods.

@item The @value{tramp} filename syntax differs between GNU Emacs and XEmacs.

The GNU Emacs maintainers wish to use a unified filename syntax for
Ange-FTP and @value{tramp} so that users don't have to learn a new
syntax.  It is sufficient to learn some extensions to the old syntax.

For the XEmacs maintainers, the problems caused from using a unified
filename syntax are greater than the gains.  The XEmacs package system
uses EFS for downloading new packages.  So, obviously, EFS has to be
installed from the start.  If the filenames were unified, @value{tramp}
would have to be installed from the start, too.

@ifset xemacs
@strong{Note:} If you'd like to use a similar syntax like
@value{ftppackagename}, you need the following settings in your init
file:

@lisp
(setq tramp-unified-filenames t)
(require 'tramp)
@end lisp

The autoload of the @value{emacsname} @value{tramp} package must be
disabled.  This can be achieved by setting file permissions @code{000}
to the files @file{.../xemacs-packages/lisp/tramp/auto-autoloads.el*}.

In case of unified filenames, all @value{emacsname} download sites are
added to @code{tramp-default-method-alist} with default method
@option{ftp} @xref{Default Method}.  These settings shouldn't be
touched for proper working of the @value{emacsname} package system.

The syntax for unified filenames is described in the @value{tramp} manual
for @value{emacsothername}.
@end ifset
@end itemize

@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include doclicense.texi

@node Function Index
@unnumbered Function Index
@printindex fn

@node Variable Index
@unnumbered Variable Index
@printindex vr

@node Concept Index
@unnumbered Concept Index
@printindex cp

@contents
@c End of tramp.texi - the TRAMP User Manual
@bye

@c TODO
@c
@c * Say something about the .login and .profile files of the remote
@c   shells.
@c * Explain how tramp.el works in principle: open a shell on a remote
@c   host and then send commands to it.
@c * Make terminology "inline" vs "out-of-band" consistent.
@c   It seems that "external" is also used instead of "out-of-band".

@c * M. Albinus
@c ** Use `filename' resp. `file name' consistently.
@c ** Use `host' resp. `machine' consistently.
@c ** Consistent small or capitalized words especially in menues.

@ignore
   arch-tag: f96dd66e-6dd3-4c92-8d77-9c56205ba808
@end ignore