summaryrefslogtreecommitdiff
path: root/doc/misc/tramp.texi
blob: 2133dfec35abd3382812e32c835f8ad8ccc1bd57 (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
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
\input texinfo   @c -*- mode: texinfo; coding: utf-8 -*-
@setfilename ../../info/tramp.info
@c %**start of header
@include docstyle.texi
@c In the Tramp GIT, the version number is auto-frobbed from tramp.el,
@c and the bug report address is auto-frobbed from configure.ac.
@include trampver.texi
@settitle @value{tramp} @value{trampver} User Manual
@c %**end of header

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

@copying
Copyright @copyright{} 1999--2020 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.3 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.''
@end quotation
@end copying

@c Entries for @command{install-info} to use.  We cannot use @value{tramp}.
@dircategory Emacs network features
@direntry
* Tramp: (tramp).               Transparent Remote Access, Multiple Protocol
                                  Emacs remote file access via ssh and scp.
@end direntry

@titlepage
@title @value{tramp} @value{trampver} User Manual
@author by Daniel Pittman
@author based on documentation by Kai GroĂźjohann
@end titlepage

@contents


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

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

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

The difference is that Ange FTP 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{@value{trampurl}}.

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

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

There is a mailing list for @value{tramp}, available at
@email{@value{tramp-bug-report-address}}, and archived at
@uref{https://lists.gnu.org/r/tramp-devel/, the @value{tramp} Mail
Archive}.

@page
@insertcopying

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

For the end user:

* Obtaining @value{tramp}::             How to obtain @value{tramp}.
@ifset installchapter
* Installation::                Installing @value{tramp} with your Emacs.
@end ifset
* Quick Start Guide::           Short introduction how to use @value{tramp}.
* 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.

For the developer:

* Files directories and localnames::
                                How file names, directories and localnames
                                  are mangled and managed.
* Traces and Profiles::         How to Customize Traces.

* GNU Free Documentation License:: The license for this documentation.
* Function Index::              @value{tramp} functions.
* Variable Index::              User options and variables.
* Concept Index::               An item for each concept.

@detailmenu
 --- The Detailed Node Listing ---
@c
@ifset installchapter

Installing @value{tramp} with your Emacs

* System Requirements::         Prerequisites for @value{tramp} installation.
* Basic Installation::          Installation steps.
* Installation parameters::     Parameters in order to control installation.
* Testing::                     A test suite for @value{tramp}.
* Load paths::                  How to plug-in @value{tramp} into your environment.
@end ifset

Configuring @value{tramp} for use

* Connection types::            Types of connections to remote hosts.
* Inline methods::              Inline methods.
* External methods::            External methods.
* GVFS-based methods::          @acronym{GVFS}-based external methods.
* 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.
* Firewalls::                   Passing firewalls.
* 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.
* Predefined connection information::
                                Setting own connection related information.
* Remote programs::             How @value{tramp} finds and uses programs on the remote host.
* Remote shell setup::          Remote shell setup hints.
* Android shell setup::         Android shell setup hints.
* Auto-save and Backup::        Auto-save and Backup.
* Keeping files encrypted::     Protect remote files by encryption.
* Windows setup hints::         Issues with Cygwin ssh.

Using @value{tramp}

* File name syntax::            @value{tramp} file name conventions.
@ifset unified
* Change file name syntax::     Alternative file name syntax.
@end ifset
* File name completion::        File name completion.
* Ad-hoc multi-hops::           Declaring multiple hops in the file name.
* Remote processes::            Integration with other Emacs packages.
* Cleanup remote connections::  Cleanup remote connections.
* Renaming remote files::       Renaming remote files.
* Archive file names::          Access to files in file archives.

How file names, directories and localnames are mangled and managed

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

@end detailmenu
@end menu


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

@value{tramp} is for transparently accessing remote files from within
Emacs.  @value{tramp} enables an easy, convenient, and consistent
interface to remote files as if they are local files.  @value{tramp}'s
transparency extends to editing, version control, and @code{dired}.

@value{tramp} can access remote hosts using any number of access
methods, such as @command{rsh}, @command{rlogin}, @command{telnet},
and related programs.  If these programs can successfully pass
@acronym{ASCII} characters, @value{tramp} can use them.
@value{tramp} does not require or mandate 8-bit clean connections.

@value{tramp}'s most common access method is through @command{ssh}, a
more secure alternative to @command{ftp} and other older access
methods.

@value{tramp} on MS Windows operating systems is integrated with the
PuTTY package, and uses the @command{plink} program.

@value{tramp} mostly operates transparently in the background using
the connection programs.  As long as these programs enable remote login
and can use the terminal, @value{tramp} can adapt them for seamless
and transparent access.

@value{tramp} temporarily transfers a remote file's contents to the
local host editing and related operations.  @value{tramp} can also
transfer files between hosts using standard Emacs interfaces, a
benefit of direct integration of @value{tramp} in Emacs.

@value{tramp} can transfer files using any number of available host
programs for remote files, such as @command{rcp}, @command{scp},
@command{rsync} or (under MS Windows) @command{pscp}.  @value{tramp}
provides easy ways to specify these programs and customize them to
specific files, hosts, or access methods.

For faster small-size file transfers, @value{tramp} supports encoded
transfers directly through the shell using @command{mimencode} or
@command{uuencode} provided such tools are available on the remote
host.


@subsubheading @value{tramp} behind the scenes
@cindex behind the scenes
@cindex details of operation
@cindex how it works

Accessing a remote file through @value{tramp} entails a series of
actions, many of which are transparent to the user.  Yet some actions
may require user response (such as entering passwords or completing
file names).  One typical scenario, opening a file on a remote host, is
presented here to illustrate the steps involved:

@kbd{C-x C-f} to initiate find-file, enter part of the @value{tramp}
file name, then hit @kbd{@key{TAB}} for completion.  If this is the
first time connection to that host, here's what happens:

@itemize
@item
@value{tramp} invokes @samp{telnet @var{host}} or @samp{rsh @var{host}
-l @var{user}} and establishes an external process to connect to the
remote host.  @value{tramp} communicates with the process through an
Emacs buffer, which also shows output from the remote host.

@item
The remote host may prompt for a login name (for @command{telnet}, for
example) in the buffer.  If on the other hand, the login name was
included in the file name portion, @value{tramp} sends the login name
followed by a newline.

@item
The remote host may then prompt for a password or passphrase (for
@command{rsh} or for @command{telnet}).  @value{tramp} displays the
password prompt in the minibuffer.  @value{tramp} then sends whatever
is entered to the remote host, followed by a newline.

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

If @value{tramp} does not receive any messages within a timeout period
(a minute, for example), then @value{tramp} responds with an error
message about not finding the remote shell prompt.  If any messages
from the remote host, @value{tramp} displays them in the buffer.

For any @samp{login failed} message from the remote host,
@value{tramp} aborts the login attempt, and repeats the login steps
again.

@item
Upon successful login and @value{tramp} recognizes the shell prompt
from the remote host, @value{tramp} prepares the shell environment by
turning off echoing, setting shell prompt, and other housekeeping
chores.

@strong{Note} that for the remote shell, @value{tramp} invokes
@command{/bin/sh}.  The remote host must recognize @samp{exec /bin/sh}
and execute the appropriate shell.  This shell must support Bourne
shell syntax.

@item
@value{tramp} executes @command{cd} and @command{ls} commands to find
which files exist on the remote host.  @value{tramp} sometimes uses
@command{echo} with globbing.  @value{tramp} checks if a file or
directory is writable with @command{test}.  After each command,
@value{tramp} parses the output from the remote host for completing
the next operation.

@item
After remote file name completion, @value{tramp} transfers the file
contents from the remote host.

For inline transfers, @value{tramp} sends a command, such as
@samp{mimencode -b /path/to/remote/file}, waits until the output has
accumulated in the buffer, decodes that output to produce the file's
contents.

For external transfers, @value{tramp} sends a command as follows:
@example
rcp user@@host:/path/to/remote/file /tmp/tramp.4711
@end example
@value{tramp} reads the local temporary file @file{/tmp/tramp.4711}
into a buffer, and then deletes the temporary file.

@item
Edit, modify, change the buffer contents as normal, and then save the
buffer with @kbd{C-x C-s}.

@item
@value{tramp} transfers the buffer contents to the remote host in
a reverse of the process using the appropriate inline or external
program.
@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 @value{tramp}
@chapter Obtaining @value{tramp}
@cindex obtaining @value{tramp}
@cindex GNU ELPA
@vindex tramp-version

@value{tramp} is included as part of Emacs (since @w{Emacs 22.1}).

@value{tramp} is also freely packaged for download on the Internet at
@uref{https://ftp.gnu.org/gnu/tramp/}.  The version number of
@value{tramp} can be obtained by the variable @code{tramp-version}.
For released @value{tramp} versions, this is a three-number string
like ``2.4.5''.

A @value{tramp} release, which is packaged with Emacs, could differ
slightly from the corresponding standalone release.  This is because
it isn't always possible to synchronize release dates between Emacs
and @value{tramp}.  Such version numbers have the Emacs version number
as suffix, like ``2.4.5.27.2''.  This means @w{@value{tramp} 2.4.5} as
integrated in @w{Emacs 27.2}.  A complete list of @value{tramp}
versions packaged with Emacs can be retrieved by

@vindex customize-package-emacs-version-alist
@lisp
(assoc 'Tramp customize-package-emacs-version-alist)
@end lisp

@value{tramp} is also available as @uref{https://elpa.gnu.org, GNU
ELPA} package.  Besides the standalone releases, further minor version
of @value{tramp} will appear on GNU ELPA, until the next @value{tramp}
release appears.  These minor versions have a four-number string, like
``2.4.5.1''.

@value{tramp} development versions are available on Git servers.
Development versions contain new and incomplete features.  The
development version of @value{tramp} is always the version number of
the next release, plus the suffix ``-pre'', like ``2.4.4-pre''.

One way to obtain @value{tramp} from Git server is to visit the
Savannah project page at the following URL and then clicking on the
Git link in the navigation bar at the top.

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

@noindent
Another way is to follow the terminal session below:

@example
@group
$ cd ~/emacs
$ git clone git://git.savannah.gnu.org/tramp.git
@end group
@end example

@noindent
From behind a firewall:

@example
@group
$ git config --global http.proxy http://user:pwd@@proxy.server.com:8080
$ git clone https://git.savannah.gnu.org/r/tramp.git
@end group
@end example

@noindent
@value{tramp} developers:

@example
$ git clone login@@git.sv.gnu.org:/srv/git/tramp.git
@end example

@noindent
After one of the above commands, @file{~/emacs/tramp} will
containing the latest version of @value{tramp}.

@noindent
To fetch updates from the repository, use @code{git pull}:

@example
@group
$ cd ~/emacs/tramp
$ git pull
@end group
@end example

@noindent
Run @command{autoconf} as follows to generate an up-to-date
@file{configure} script:

@example
@group
$ cd ~/emacs/tramp
$ autoconf
@end group
@end example

@ifset installchapter
@c Installation chapter is necessary only in case of standalone
@c installation.
@include trampinst.texi
@end ifset
@ifclear installchapter
See the file @file{INSTALL} in that directory for further information
how to install @value{tramp}.
@end ifclear


@node Quick Start Guide
@chapter Short introduction how to use @value{tramp}
@cindex quick start guide

@value{tramp} extends the Emacs file name syntax by a remote
component.  A remote file name looks always like
@file{@trampfn{method,user@@host,/path/to/file}}.

You can use remote files exactly like ordinary files, that means you
could open a file or directory by @kbd{C-x C-f
@trampfn{method,user@@host,/path/to/file} @key{RET}}, edit the file,
and save it.  You can also mix local files and remote files in file
operations with two arguments, like @code{copy-file} or
@code{rename-file}.  And finally, you can run even processes on a
remote host, when the buffer you call the process from has a remote
@code{default-directory}.


@anchor{Quick Start Guide: File name syntax}
@section File name syntax
@cindex file name syntax

Remote file names are prepended by the @code{method}, @code{user} and
@code{host} parts.  All of them, and also the local file name part,
are optional, in case of a missing part a default value is assumed.
The default value for an empty local file name part is the remote
user's home directory.  The shortest remote file name is
@file{@trampfn{-,,}}, therefore.  The @samp{-} notation for the
default host is used for syntactical reasons, @ref{Default Host}.

The @code{method} part describes the connection method used to reach
the remote host, see below.

The @code{user} part is the user name for accessing the remote host.
For the @option{smb} method, this could also require a domain name, in
this case it is written as @code{user%domain}.

The @code{host} part must be a host name which could be resolved on
your local host.  It could be a short host name, a fully qualified
domain name, an IPv4 or IPv6 address, @ref{File name syntax}.  Some
connection methods support also a notation of the port to be used, in
this case it is written as @code{host#port}.


@anchor{Quick Start Guide: @option{ssh} and @option{plink} methods}
@section Using @option{ssh} and @option{plink}
@cindex method @option{ssh}
@cindex @option{ssh} method
@cindex method @option{plink}
@cindex @option{plink} method

If your local host runs an SSH client, and the remote host runs an SSH
server, the simplest remote file name is
@file{@trampfn{ssh,user@@host,/path/to/file}}.  The remote file name
@file{@trampfn{ssh,,}} opens a remote connection to yourself on the
local host, and is taken often for testing @value{tramp}.

On MS Windows, PuTTY is often used as SSH client.  Its @command{plink}
method can be used there to open a connection to a remote host running
an @command{ssh} server:
@file{@trampfn{plink,user@@host,/path/to/file}}.


@anchor{Quick Start Guide: @option{su}, @option{sudo} and @option{sg} methods}
@section Using @option{su}, @option{sudo} and @option{sg}
@cindex method @option{su}
@cindex @option{su} method
@cindex method @option{sudo}
@cindex @option{sudo} method
@cindex method @option{sg}
@cindex @option{sg} method

Sometimes, it is necessary to work on your local host under different
permissions.  For this, you could use the @option{su} or @option{sudo}
connection method.  Both methods use @samp{root} as default user name
and the return value of @code{(system-name)} as default host name.
Therefore, it is convenient to open a file as
@file{@trampfn{sudo,,/path/to/file}}.

The method @option{sg} stands for ``switch group''; the changed group
must be used here as user name.  The default host name is the same.


@anchor{Quick Start Guide: @option{ssh}, @option{plink}, @option{su}, @option{sudo} and @option{sg} methods}
@section Combining @option{ssh} or @option{plink} with @option{su} or @option{sudo}
@cindex method @option{ssh}
@cindex @option{ssh} method
@cindex method @option{plink}
@cindex @option{plink} method
@cindex method @option{su}
@cindex @option{su} method
@cindex method @option{sudo}
@cindex @option{sudo} method

If the @option{su} or @option{sudo} option shall be performed on
another host, it could be comnbined with a leading @option{ssh} or
@option{plink} option.  That means, @value{tramp} connects first to
the other host with non-administrative credentials, and changes to
administrative credentials on that host afterwards.  In a simple case,
the syntax looks like
@file{@value{prefix}ssh@value{postfixhop}user@@host|sudo@value{postfixhop}@value{postfix}/path/to/file}.
@xref{Ad-hoc multi-hops}.


@anchor{Quick Start Guide: @option{sudoedit} method}
@section Using @command{sudoedit}
@cindex method @option{sudoedit}
@cindex @option{sudoedit} method

The @option{sudoedit} method is similar to the @option{sudo} method.
However, it is a different implementation: it does not keep an open
session running in the background.  This is for security reasons; on
the backside this method is less performant than the @option{sudo}
method, it is restricted to the @samp{localhost} only, and it does not
support external processes.


@anchor{Quick Start Guide: @option{smb} method}
@section Using @command{smbclient}
@cindex method @option{smb}
@cindex @option{smb} method
@cindex ms windows (with @option{smb} method)
@cindex @command{smbclient}

In order to access a remote MS Windows host or Samba server, the
@command{smbclient} client is used.  The remote file name syntax is
@file{@trampfn{smb,user%domain@@host,/path/to/file}}.  The first part
of the local file name is the share exported by the remote host,
@samp{path} in this example.


@anchor{Quick Start Guide: GVFS-based methods}
@section Using @acronym{GVFS}-based methods
@cindex methods, gvfs
@cindex gvfs-based methods
@cindex method @option{sftp}
@cindex @option{sftp} method
@cindex method @option{afp}
@cindex @option{afp} method
@cindex method @option{dav}
@cindex method @option{davs}
@cindex @option{dav} method
@cindex @option{davs} method
@cindex method @option{mtp}
@cindex @option{mtp} method

On systems, which have installed @acronym{GVFS, the GNOME Virtual File
System}, its offered methods could be used by @value{tramp}.  Examples
are @file{@trampfn{sftp,user@@host,/path/to/file}},
@file{@trampfn{afp,user@@host,/path/to/file}} (accessing Apple's AFP
file system), @file{@trampfn{dav,user@@host,/path/to/file}},
@file{@trampfn{davs,user@@host,/path/to/file}} (for WebDAV shares) and
@file{@trampfn{mtp,device,/path/to/file}} (for media devices).


@anchor{Quick Start Guide: GNOME Online Accounts based methods}
@section Using @acronym{GNOME} Online Accounts based methods
@cindex @acronym{GNOME} Online Accounts
@cindex method @option{gdrive}
@cindex @option{gdrive} method
@cindex google drive
@cindex method @option{nextcloud}
@cindex @option{nextcloud} method
@cindex nextcloud

@acronym{GVFS}-based methods include also @acronym{GNOME} Online
Accounts, which support the @option{Files} service.  These are the
Google Drive file system, and the OwnCloud/NextCloud file system.  The
file name syntax is here always
@file{@trampfn{gdrive,john.doe@@gmail.com,/path/to/file}}
(@samp{john.doe@@gmail.com} stands here for your Google Drive
account), or @file{@trampfn{nextcloud,user@@host#8081,/path/to/file}}
(@samp{8081} stands for the port number) for OwnCloud/NextCloud files.


@anchor{Quick Start Guide: Android}
@section Using Android
@cindex method @option{adb}
@cindex @option{adb} method
@cindex android

An Android device, which is connected via USB to your local host, can
be accessed via the @command{adb} command.  No user or host name is
needed.  The file name syntax is @file{@trampfn{adb,,/path/to/file}}.


@anchor{Quick Start Guide: @option{rclone} method}
@section Using @command{rclone}
@cindex method @option{rclone}
@cindex @option{rclone} method

A convenient way to access system storages is the @command{rclone}
program.  If you have configured a storage in @command{rclone} under a
name @samp{storage} (for example), you could access it via the remote
file name syntax @file{@trampfn{rclone,storage,/path/to/file}}.  User
names are not needed.


@node Configuration
@chapter Configuring @value{tramp}
@cindex configuration
@cindex default configuration

@value{tramp} is initially configured to use the @command{scp} program
to connect to the remote host.  Just type @kbd{C-x C-f} and then enter
file name @file{@trampfn{scp,user@@host,/path/to/file}}.  For details,
@xref{Default Method}, @xref{Default User}, @xref{Default Host}.

For problems related to the behavior of the remote shell, @xref{Remote
shell setup}.

For changing the connection type and file access method from the
defaults to one of several other options, @xref{Connection types}.

@strong{Note} that some user options described in these examples are
not auto loaded by Emacs.  All examples require @value{tramp} is
installed and loaded:

@lisp
(customize-set-variable 'tramp-verbose 6 "Enable remote command traces")
@end lisp

For functions used to configure @value{tramp}, the following clause
might be used in your init file:

@lisp
(with-eval-after-load 'tramp (tramp-change-syntax 'simplified))
@end lisp


@menu
* Connection types::            Types of connections to remote hosts.
* Inline methods::              Inline methods.
* External methods::            External methods.
* GVFS-based methods::          @acronym{GVFS}-based external methods.
* 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.
* Firewalls::                   Passing firewalls.
* 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.
* Predefined connection information::
                                Setting own connection related information.
* Remote programs::             How @value{tramp} finds and uses programs on the remote host.
* Remote shell setup::          Remote shell setup hints.
* Android shell setup::         Android shell setup hints.
* Auto-save and Backup::        Auto-save and Backup.
* Keeping files encrypted::     Protect remote files by encryption.
* Windows setup hints::         Issues with Cygwin ssh.
@end menu


@node Connection types
@section Types of connections to remote hosts
@cindex connection types, overview

@dfn{Inline method} and @dfn{external method} are the two basic types
of access methods.  While they both use the same remote shell access
programs, such as @command{rsh}, @command{ssh}, or @command{telnet},
they differ in the file access methods.  Choosing the right method
becomes important for editing files, transferring large files, or
operating on a large number of files.

The performance of the external 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 @option{scp}-based access
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 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, which will be enabled by default if
available.  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

Inline methods use the same login connection to transfer file
contents.  Inline methods are quick and easy for small files.  They
depend on the availability of suitable encoding and decoding programs
on the remote host.  For local source and destination, @value{tramp}
may use built-in equivalents of such programs in Emacs.

Inline methods can work in situations where an external transfer
program is unavailable.  Inline methods also work when transferring
files between different @emph{user identities} on the same host.

@cindex base-64 encoding
@cindex base-64 encoding
@cindex uu encoding
@vindex tramp-remote-coding-commands
@value{tramp} checks the remote host for the availability and
usability of one of the commands defined in
@code{tramp-remote-coding-commands}.  @value{tramp} uses the first
reliable command it finds.  @value{tramp}'s search path can be
customized, see @ref{Remote programs}.

In case none of the commands are unavailable, @value{tramp} first
transfers a small Perl program to the remote host, and then tries that
program for encoding and decoding.

@vindex tramp-inline-compress-start-size
@vindex tramp-inline-compress-commands
To increase transfer speeds for large text files, use compression
before encoding.  The user option
@code{tramp-inline-compress-start-size} specifies the file size for
such optimization.  This feature depends on the availability and
usability of one of the commands defined in
@code{tramp-inline-compress-commands}.

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

@command{rsh} is an option for connecting to hosts within local
networks since @command{rsh} is not as secure as other methods.

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

@command{ssh} is a more secure option than others to connect to a
remote host.

@command{ssh} can also take extra parameters as port numbers.  For
example, a host on port 42 is specified as @file{host#42} (the real
host name, a hash sign, then a port number).  It is the same as passing
@samp{-p 42} to the @command{ssh} command.

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

Connecting to a remote host with @command{telnet} is as insecure
as the @option{rsh} method.

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

Instead of connecting to a remote host, @command{su} program allows
editing as another user.  The host can be either @samp{localhost} or
the host returned by the function @command{(system-name)}.  See
@ref{Multi-hops} for an exception to this behavior.

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

Similar to @option{su} method, @option{sudo} uses @command{sudo}.
@command{sudo} must have sufficient rights to start a shell.

For security reasons, a @option{sudo} connection is disabled after a
predefined timeout (5 minutes per default).  This can be changed, see
@ref{Predefined connection information}.

@item @option{doas}
@cindex method @option{doas}
@cindex @option{doas} method

This method is used on OpenBSD like the @command{sudo} command.  Like
the @option{sudo} method, a @option{doas} connection is disabled after
a predefined timeout.

@item @option{sg}
@cindex method @option{sg}
@cindex @option{sg} method

The @command{sg} program allows editing as different group.  The host
can be either @samp{localhost} or the host returned by the function
@command{(system-name)}.  The user name must be specified, but it
denotes a group name.  See @ref{Multi-hops} for an exception to this
behavior.

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

Works like @option{ssh} but without the extra authentication prompts.
@option{sshx} uses @samp{ssh -t -t @var{host} -l @var{user} /bin/sh}
to open a connection with a ``standard'' login shell.  It supports
changing the remote login shell @command{/bin/sh}.

@strong{Note} that @option{sshx} does not bypass authentication
questions.  For example, if the host key of the remote host is not
known, @option{sshx} will still ask ``Are you sure you want to
continue connecting?''.  @value{tramp} cannot handle such questions.
Connections will have to be setup where logins can proceed without
such questions.

@option{sshx} is useful for MS Windows users when @command{ssh}
triggers an error about allocating a pseudo tty.  This happens due to
missing shell prompts that confuses @value{tramp}.

@option{sshx} supports the @samp{-p} argument.

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

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

@item @option{ksu}
@cindex method @option{ksu}
@cindex @option{ksu} method
@cindex kerberos (with @option{ksu} method)

This is another method from the Kerberos suite.  It behaves like @option{su}.

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

@option{plink} method is for MS Windows users with the PuTTY
implementation of SSH@.  It uses @samp{plink -ssh} to log in to the
remote host.  It supports changing the remote login shell @command{/bin/sh}.

Check the @samp{Share SSH connections if possible} control for that
session.

@option{plink} method supports the @samp{-P} argument.

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

Another method using PuTTY on MS Windows with session names instead of
host names.  @option{plinkx} calls @samp{plink -load @var{session}
-t}.  User names and port numbers must be defined in the session.  It
supports changing the remote login shell @command{/bin/sh}.

Check the @samp{Share SSH connections if possible} control for that
session.

@end table


@node External methods
@section External methods
@cindex methods, external
@cindex external methods

External methods operate over multiple channels, using the remote
shell connection for some actions while delegating file transfers to
an external transfer program.

External methods save on the overhead of encoding and decoding of
inline methods.

Since external methods have the overhead of opening a new channel,
files smaller than @code{tramp-copy-size-limit} still use inline
methods.

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

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

The alternative method @option{remcp} uses the @command{remsh} and
@command{rcp} commands.

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

Using a combination of @command{ssh} to connect and @command{scp} to
transfer is the most secure.  While the performance is good, it is
slower than the inline methods for smaller files.  Though there is no
overhead of encoding and decoding of the inline methods,
@command{scp}'s cryptographic handshake negates those speed gains.

@option{ssh}-based methods support @samp{-p} feature for specifying
port numbers.  For example, @file{host#42} passes @samp{-p 42} in the
argument list to @command{ssh}, and @samp{-P 42} in the argument list
to @command{scp}.

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

@command{ssh} command to connect in combination with @command{rsync}
command to transfer is similar to the @option{scp} method.

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

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

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

@option{scpx} is useful to avoid login shell questions.  It is similar
in performance to @option{scp}.  @option{scpx} uses @samp{ssh -t -t
@var{host} -l @var{user} /bin/sh} to open a connection.  It supports
changing the remote login shell @command{/bin/sh}.

@option{scpx} is useful for MS Windows users when @command{ssh}
triggers an error about allocating a pseudo tty.  This happens due to
missing shell prompts that confuses @value{tramp}.

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

@item @option{pscp}
@item @option{psftp}
@cindex method @option{pscp}
@cindex @option{pscp} method
@cindex @command{plink} (with @option{pscp} method)
@cindex @command{putty} (with @option{pscp} method)
@cindex method @option{psftp}
@cindex @option{psftp} method
@cindex @command{plink} (with @option{psftp} method)
@cindex @command{putty} (with @option{psftp} method)

These methods are similar to @option{scp} or @option{sftp}, but they
use the @command{plink} command to connect to the remote host, and
they use @command{pscp} or @command{psftp} for transferring the files.
These programs are part of PuTTY, an SSH implementation for MS Windows.

They support changing the remote login shell @command{/bin/sh}.

Check the @samp{Share SSH connections if possible} control for that
session.

These methods support the @samp{-P} argument.

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

This method is similar to @option{scp}, but uses @command{fsh} to
connect and @command{fcp} to transfer files.  @command{fsh/fcp}, a
front-end for @command{ssh}, reuse @command{ssh} session by
submitting several commands.  This avoids the startup overhead due to
@command{scp}'s secure connection.  Inline methods have similar
benefits.

The command used for this connection is: @samp{fsh @var{host} -l
@var{user} /bin/sh -i}

@cindex method @option{fsh}
@cindex @option{fsh} method

@option{fsh} has no inline method since the multiplexing it offers is
not useful for @value{tramp}.  @command{fsh} connects to remote host
and @value{tramp} keeps that one connection open.

@item @option{nc}
@cindex method @option{nc}
@cindex @option{nc} method
@cindex @command{telnet} (with @option{nc} method)

Using @command{telnet} to connect and @command{nc} to transfer files
is sometimes the only combination suitable for accessing routers or
NAS hosts.  These dumb devices have severely restricted local shells,
such as the @command{busybox} and do not host any other encode or
decode programs.

@item @option{sudoedit}
@cindex method @option{sudoedit}
@cindex @option{sudoedit} method

The @option{sudoedit} method allows to edit a file as a different user
on the local host.  You could regard this as @value{tramp}'s
implementation of the @command{sudoedit}.  Contrary to the
@option{sudo} method, all magic file name functions are implemented by
single @command{sudo @dots{}}  commands.  The purpose is to make
editing such a file as secure as possible; there must be no session
running in the Emacs background which could be attacked from inside
Emacs.

Consequently, external processes are not implemented.

The host name of such remote file names must represent the local host.
Since the default value is already proper, it is recommended not to
use any host name in the remote file name, like
@file{@trampfn{sudoedit,,/path/to/file}} or
@file{@trampfn{sudoedit,user@@,/path/to/file}}.

Like the @option{sudo} method, a @option{sudoedit} password expires
after a predefined timeout.

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

When @value{tramp} uses @option{ftp}, it forwards requests to whatever
ftp program is specified by Ange FTP@.  This external program must be
capable of servicing requests from @value{tramp}.

@item @option{smb}
@cindex method @option{smb}
@cindex @option{smb} method
@cindex ms windows (with @option{smb} method)
@cindex @command{smbclient}

This non-native @value{tramp} method connects via the Server Message
Block (SMB) networking protocol to hosts running file servers that are
typically based on @url{https://www.samba.org/,,Samba} or MS Windows.

Using @command{smbclient} requires a few tweaks when working with
@value{tramp}:

The first directory in the localname must be a share name on the
remote host.

Since some SMB share names end in the @code{$} character,
@value{tramp} must use @code{$$} when specifying those shares to avoid
environment variable substitutions.

When @value{tramp} is not specific about the share name or uses the
generic remote directory @file{/}, @command{smbclient} returns all
available shares.

Since SMB authentication is based on each SMB share, @value{tramp}
prompts for a password even when accessing a different share on the
same SMB host.  This prompting can be suppressed by @ref{Password
handling}.

To accommodate user name/domain name syntax required by MS Windows
authorization, @value{tramp} provides for an extended syntax in
@code{user%domain} format (where @code{user} is the user name,
@code{%} is the percent symbol, and @code{domain} is the MS Windows
domain name).  An example:

@example
@trampfn{smb,daniel%BIZARRE@@melancholia,/daniel$$/.emacs}
@end example

where user @code{daniel} connects as a domain user to the SMB host
@code{melancholia} in the MS Windows domain @code{BIZARRE} to edit
@file{.emacs} located in the home directory (share @code{daniel$}).

Alternatively, for local WINS users (as opposed to domain users),
substitute the domain name with the name of the local host in
UPPERCASE as shown here:

@example
@trampfn{smb,daniel%MELANCHOLIA@@melancholia,/daniel$$/.emacs}
@end example

where user @code{daniel} connects as local user to the SMB host
@code{melancholia} in the local domain @code{MELANCHOLIA} to edit
@file{.emacs} located in the home directory (share @code{daniel$}).

The domain name and user name are optional for @command{smbclient}
authentication.  When user name is not specified, @command{smbclient}
uses the anonymous user (without prompting for password).  This
behavior is unlike other @value{tramp} methods, where local user name
is substituted.

The @option{smb} method is unavailable if Emacs is run under a local
user authentication context in MS Windows.  However such users can
still access remote files using UNC file names instead of @value{tramp}:

@example
//melancholia/daniel$$/.emacs
@end example

UNC file name specification does not allow the specification of a
different user name for authentication like the @command{smbclient}
can.


@item @option{adb}
@cindex method @option{adb}
@cindex @option{adb} method
@cindex android (with @option{adb} method)

@vindex tramp-adb-program
@vindex PATH@r{, environment variable}
This method uses Android Debug Bridge program for accessing Android
devices.  The Android Debug Bridge must be installed locally for
@value{tramp} to work.  Some GNU/Linux distributions provide Android
Debug Bridge as an installation package.  Alternatively, the program
is installed as part of the Android SDK@.  @value{tramp} finds the
@command{adb} program either via the @env{PATH} environment variable
or the absolute path set in the user option @code{tramp-adb-program}.

@vindex tramp-adb-connect-if-not-connected
@value{tramp} connects to Android devices with @option{adb} only when
the user option @code{tramp-adb-connect-if-not-connected} is not
@code{nil}.  Otherwise, the connection must be established outside
Emacs.

@value{tramp} does not require a host name part of the remote file
name when a single Android device is connected to @command{adb}.
@value{tramp} instead uses @file{@trampfn{adb,,}} as the default name.
@command{adb devices}, run in a shell outside Emacs, shows available
host names.

@option{adb} method normally does not need user name to authenticate
on the Android device because it runs under the @command{adbd}
process.  But when a user name is specified, however, @value{tramp}
applies an @command{su} in the syntax.  When authentication does not
succeed, especially on un-rooted Android devices, @value{tramp}
displays login errors.

For Android devices connected through TCP/IP, a port number can be
specified using @file{device#42} host name syntax or @value{tramp} can
use the default value as declared in @command{adb} command.  Port
numbers are not applicable to Android devices connected through USB@.


@item @option{rclone}
@cindex method @option{rclone}
@cindex @option{rclone} method

@vindex tramp-rclone-program
The program @command{rclone} allows to access different system
storages in the cloud, see @url{https://rclone.org/} for a list of
supported systems.  If the @command{rclone} program isn't found in
your @env{PATH} environment variable, you can tell @value{tramp} its
absolute path via the user option @code{tramp-rclone-program}.

A system storage must be configured via the @command{rclone config}
command, outside Emacs.  If you have configured a storage in
@command{rclone} under a name @samp{storage} (for example), you could
access it via the remote file name

@example
@trampfn{rclone,storage,/path/to/file}
@end example

User names are part of the @command{rclone} configuration, and not
needed in the remote file name.  If a user name is contained in the
remote file name, it is ignored.

Internally, @value{tramp} mounts the remote system storage at location
@file{/tmp/tramp.rclone.storage}, with @file{storage} being the name
of the configured system storage.

Optional flags to the different @option{rclone} operations could be
passed as connection property, @xref{Predefined connection
information}.  Supported properties are @t{"mount-args"},
@t{"copyto-args"} and @t{"moveto-args"}.

Access via @option{rclone} is slow.  If you have an alternative method
for accessing the system storage, you shall prefer this.
@ref{GVFS-based methods} for example, methods @option{gdrive} and
@option{nextcloud}.

@end table


@node GVFS-based methods
@section @acronym{GVFS}-based external methods
@cindex methods, gvfs
@cindex gvfs-based methods
@cindex dbus

@acronym{GVFS} is the virtual file system for the @acronym{GNOME}
Desktop, @uref{https://en.wikipedia.org/wiki/GVFS}.  Remote files on
@acronym{GVFS} are mounted locally through FUSE and @value{tramp} uses
this locally mounted directory internally.

Emacs uses the D-Bus mechanism to communicate with @acronym{GVFS}@.
Emacs must have the message bus system, D-Bus integration active,
@pxref{Top, , D-Bus, dbus}.

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

This method is for connecting to remote hosts with the Apple Filing
Protocol for accessing files on macOS volumes.  @value{tramp} access
syntax requires a leading volume (share) name, for example:
@file{@trampfn{afp,user@@host,/volume}}.

@item @option{dav}
@item @option{davs}
@cindex method @option{dav}
@cindex method @option{davs}
@cindex @option{dav} method
@cindex @option{davs} method

@option{dav} method provides access to WebDAV files and directories
based on standard protocols, such as HTTP@.  @option{davs} does the same
but with SSL encryption.  Both methods support the port numbers.

Paths being part of the WebDAV volume to be mounted by @acronym{GVFS},
as it is common for OwnCloud or NextCloud file names, are not
supported by these methods.  See method @option{nextcloud} for
handling them.

@item @option{gdrive}
@cindex @acronym{GNOME} Online Accounts
@cindex method @option{gdrive}
@cindex @option{gdrive} method
@cindex google drive

Via the @option{gdrive} method it is possible to access your Google
Drive online storage.  User and host name of the remote file name are
your email address of the Google Drive credentials, like
@file{@trampfn{gdrive,john.doe@@gmail.com,/}}.  These credentials must
be populated in your @command{Online Accounts} application outside Emacs.

Since Google Drive uses cryptic blob file names internally,
@value{tramp} works with the @code{display-name} of the files.  This
could produce unexpected behavior in case two files in the same
directory have the same @code{display-name}, such a situation must be avoided.

@item @option{mtp}
@cindex method @option{mtp}
@cindex @option{mtp} method
@cindex media

Media devices, like cell phones, tablets, cameras, can be accessed via
the @option{mtp} method.  Just the device name is needed in order to
specify the host in the file name.  However, the device must already
be connected via USB, before accessing it.  Possible device names are
visible via host name completion, @ref{File name completion}.

Depending on the device type, the access could be read-only.  Some
devices are accessible under different names in parallel, offering
different parts of their file system.

@value{tramp} does not require a host name as part of the remote file
name when a single media device is connected.  @value{tramp} instead
uses @file{@trampfn{mtp,,}} as the default name.

@item @option{nextcloud}
@cindex method @option{nextcloud}
@cindex @option{nextcloud} method
@cindex nextcloud

As the name indicates, the method @option{nextcloud} allows you to
access OwnCloud or NextCloud hosted files and directories.  Like the
@option{gdrive} method, your credentials must be populated in your
@command{Online Accounts} application outside Emacs. The method
supports port numbers.

@item @option{sftp}
@cindex method @option{sftp}
@cindex @option{sftp} method

This method uses @command{sftp} in order to securely access remote
hosts.  @command{sftp} is a more secure option for connecting to hosts
that for security reasons refuse @command{ssh} connections.

@end table

@defopt tramp-gvfs-methods
This user option is a list of external methods for @acronym{GVFS}@.
By default, this list includes @option{afp}, @option{dav},
@option{davs}, @option{gdrive}, @option{mtp}, @option{nextcloud} and
@option{sftp}.  Other methods to include are @option{ftp},
@option{http}, @option{https} and @option{smb}.  These methods are not
intended to be used directly as @acronym{GVFS}-based method.  Instead,
they are added here for the benefit of @ref{Archive file names}.

If you want to use @acronym{GVFS}-based @option{ftp} or @option{smb}
methods, you must add them to @code{tramp-gvfs-methods}, and you must
disable the corresponding Tramp package by setting
@code{tramp-ftp-method} or @code{tramp-smb-method} to @code{nil},
respectively:

@lisp
@group
(add-to-list 'tramp-gvfs-methods "ftp")
(customize-set-variable 'tramp-ftp-method nil)
@end group
@end lisp
@end defopt


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

In a remote file name, the use of a default method is indicated by the
pseudo method @option{-}, @ref{File name syntax}.

@defopt tramp-default-method
Default method is for transferring files.  The user option
@code{tramp-default-method} sets it.  @value{tramp} uses this user
option to determine the default method for remote file names that do
not have one specified.

@lisp
(customize-set-variable 'tramp-default-method "ssh")
@end lisp
@end defopt

@defopt tramp-default-method-alist
Default methods for transferring files can be customized for specific
user and host combinations through the user option
@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 host @samp{localhost}.

@lisp
@group
(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 group
@end lisp
@end defopt

@noindent
External methods performance faster for large files.  @pxref{Inline
methods}.  @pxref{External methods}.

Choosing the access method also depends on the security environment.
For example, @option{rsh} and @option{telnet} methods that use clear
text password transfers are inappropriate for over the Internet
connections.  Secure remote connections should use @option{ssh} that
provide encryption.


@subsection Which method to use?
@cindex choosing the right method

@value{tramp} provides maximum number of choices for maximum
flexibility.  Choosing which method depends on the hosts, clients,
network speeds, and the security context.

Start by using an inline method.

External methods might be more efficient for large files, but most
@value{tramp} users edit small files more often than large files.

Enable compression, @code{tramp-inline-compress-start-size}, for a
performance boost for large files.

Since @command{ssh} has become the most common method of remote host
access and it has the most reasonable security protocols, use
@option{ssh} method.  Typical @option{ssh} usage to edit the
@file{/etc/motd} file on the otherhost:

@example
@kbd{C-x C-f @trampfn{ssh,root@@otherhost,/etc/motd} @key{RET}}
@end example

If @option{ssh} is unavailable for whatever reason, look for other
obvious options.  For MS Windows, try the @option{plink} method.  For
Kerberos, try @option{krlogin}.

For editing local files as @option{su} or @option{sudo} methods, try
the shortened syntax of @samp{root}:

@example
@kbd{C-x C-f @trampfn{su,,/etc/motd} @key{RET}}
@end example

For editing large files, @option{scp} is faster than @option{ssh}.
@option{pscp} is faster than @option{plink}.  But this speed
improvement is not always true.


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

@defopt tramp-default-user
A @value{tramp} file name can omit the user name part since
@value{tramp} substitutes the currently logged-in user name.  However
this substitution can be overridden with @code{tramp-default-user}.
For example:

@lisp
(customize-set-variable 'tramp-default-user "root")
@end lisp
@end defopt

@defopt tramp-default-user-alist
Instead of a single default user, @code{tramp-default-user-alist}
allows multiple default user values based on access method or host
name combinations.  The alist can hold multiple values.  For example, to
use the @samp{john} as the default user for the domain
@samp{somewhere.else} only:

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

A Caution: @value{tramp} will override any default user specified in
the configuration files outside Emacs, such as @file{~/.ssh/config}.
To stop @value{tramp} from applying the default value, set the
corresponding alist entry to @code{nil}:

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

The last entry in @code{tramp-default-user-alist} should be reserved
for catch-all or most often used login.

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


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

@defopt tramp-default-host
When host name is omitted, @value{tramp} substitutes the value from
the @code{tramp-default-host} user option.  It is initially
populated with the local host name where Emacs is running.  The
default method, default user and default host can be overridden as
follows:

@lisp
@group
(custom-set-variables
 '(tramp-default-method "ssh")
 '(tramp-default-user "john")
 '(tramp-default-host "target"))
@end group
@end lisp

With all defaults set, @samp{@trampfn{-,,}} will connect @value{tramp}
to John's home directory on @code{target} via @code{ssh}.
@end defopt

@defopt tramp-default-host-alist
Instead of a single default host, @code{tramp-default-host-alist}
allows multiple default host values based on access method or user
name combinations.  The alist can hold multiple values.  While
@code{tramp-default-host} is sufficient in most cases, some methods,
like @option{adb}, require defaults overwritten.
@end defopt


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

Multi-hops are methods to reach hosts behind firewalls or to reach the
outside world from inside a bastion host.  With multi-hops,
@value{tramp} can negotiate these hops with the appropriate user/host
authentication at each hop.  All methods until now have been the single
hop kind, where the start and end points of the connection did not
have intermediate check points.

@defopt tramp-default-proxies-alist
@code{tramp-default-proxies-alist} specifies proxy hosts to pass
through.  This user option is list of triples consisting of
@code{(@var{host} @var{user} @var{proxy})}.

The first match is the proxy host through which passes the file name
and the target host matching @var{user}@@@var{host}.  @var{host} and
@var{user} are regular expressions or @code{nil}, interpreted as a
regular expression which always matches.

@var{proxy} is a literal @value{tramp} file name whose local name part
is ignored, and the method and user name parts are optional.

The method must be an inline method (@pxref{Inline methods}).  If
@var{proxy} is @code{nil}, no additional hop is required reaching
@var{user}@@@var{host}.

For example, to pass through the host @samp{bastion.your.domain} as
user @samp{bird} to reach remote hosts outside the local domain:

@lisp
@group
(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 group
@end lisp

@strong{Note}: @code{add-to-list} adds elements at the beginning of a
list.  Therefore, most relevant rules must come last in the list.

Proxy hosts can be cascaded in the alist.  If there is another host
called @samp{jump.your.domain}, which is the only host allowed to
connect to @samp{bastion.your.domain}, then:

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

@var{proxy} can take patterns @code{%h} or @code{%u} for @var{host} or
@var{user} respectively.  Ports or domains, if they are part of
a hop file name, are not expanded by those patterns.

To login as @samp{root} on remote hosts in the domain
@samp{your.domain}, but login as @samp{root} is disabled for non-local
access, then use this alist entry:

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

Opening @file{@trampfn{sudo,randomhost.your.domain,}} first connects
to @samp{randomhost.your.domain} via @code{ssh} under your account
name, and then performs @code{sudo -u root} on that host.

It is key for the @option{sudo} method in the above example to be
applied on the host after reaching it and not on the local host.
@value{tramp} checks therefore, that the host name for such hops
matches the host name of the previous hop.

@var{host}, @var{user} and @var{proxy} can also take Lisp forms.  These
forms when evaluated must return either a string or @code{nil}.

To generalize (from the previous example): For all hosts, except my
local one, first connect via @command{ssh}, and then apply
@command{sudo -u root}:

@lisp
@group
(add-to-list 'tramp-default-proxies-alist
             '(nil "\\`root\\'" "@trampfn{ssh,%h,}"))
(add-to-list 'tramp-default-proxies-alist
             '((regexp-quote (system-name)) nil nil))
@end group
@end lisp
@end defopt

Passing through hops involves dealing with restricted shells, such as
@command{rbash}.  If @value{tramp} is made aware, then it would use
them for proxies only.

@defopt tramp-restricted-shell-hosts-alist
An alist of regular expressions of hosts running restricted shells,
such as @command{rbash}.  @value{tramp} will then use them only as
proxies.

To specify the bastion host from the example above as running a
restricted shell:

@lisp
@group
(add-to-list 'tramp-restricted-shell-hosts-alist
             "\\`bastion\\.your\\.domain\\'")
@end group
@end lisp
@end defopt


@node Firewalls
@section Passing firewalls
@cindex http tunnel
@cindex proxy hosts, http tunnel

Sometimes, it is not possible to reach a remote host directly.  A
firewall might be in the way, which could be passed via a proxy
server.

Both ssh and PuTTY support such proxy settings, using an HTTP tunnel
via the @command{CONNECT} command (conforming to RFC 2616, 2817
specifications).  Proxy servers using HTTP 1.1 or later protocol
support this command.


@subsection Tunneling with ssh

With @command{ssh}, you could use the @option{ProxyCommand} entry in
@file{~/.ssh/config}:

@example
@group
Host host.other.domain
     ProxyCommand nc -X connect -x proxy.your.domain:3128 %h %p
@end group
@end example

@code{nc} is BSD's netcat program, which establishes HTTP tunnels.
Any other program with such a feature could be used as well.

In the example, opening @file{@trampfn{ssh,host.your.domain,}} passes
the HTTP proxy server @samp{proxy.your.domain} on port 3128.


@subsection Tunneling with PuTTY

PuTTY does not need an external program, HTTP tunnel support is
built-in.  In the PuTTY config program, create a session for
@samp{host.your.domain}.  In the @option{Connection/Data} entry,
select the @option{HTTP} option, and add @samp{proxy.your.domain} as
@option{Proxy hostname}, and 3128 as @option{Port}.

Opening @file{@trampfn{plinkx,host.your.domain,}} passes the HTTP
proxy server @samp{proxy.your.domain} on port 3128.


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

@vindex tramp-methods
The @code{tramp-methods} variable currently has an exhaustive list of
predefined methods.  Any part of this list can be modified with more
suitable settings.  Refer to the Lisp documentation of that variable,
accessible with @kbd{C-h v tramp-methods @key{RET}}.

In the ELPA archives, there are several examples of such extensions.
They can be installed with Emacs's Package Manager.  This includes

@table @samp
@c @item anything-tramp
@c @item counsel-tramp
@c @item helm-tramp
@c Contact MasashĂ­ MĂ­yaura <masasam@users.noreply.github.com>

@c @item ibuffer-tramp.el
@c Contact Svend Sorensen <svend@@ciffer.net>

@item docker-tramp
@cindex method @option{docker}
@cindex @option{docker} method
Integration for Docker containers.  A container is accessed via
@file{@trampfn{docker,user@@container,/path/to/file}}, where
@samp{user} is the (optional) user that you want to use, and
@samp{container} is the id or name of the container.

@item kubernetes-tramp
@cindex method @option{kubectl}
@cindex @option{kubectl} method
Integration for Docker containers deployed in a Kubernetes cluster.
It is derived from @samp{docker-tramp}.  A container is accessed via
@file{@trampfn{kubectl,user@@container,/path/to/file}}, @samp{user}
and @samp{container} have the same meaning as in @samp{docker-tramp}.

@item lxc-tramp
@cindex method @option{lxc}
@cindex @option{lxc} method
Integration for LXC containers.  A container is accessed via
@file{@trampfn{lxc,container,/path/to/file}}, @samp{container} has the
same meaning as in @samp{docker-tramp}.  A @samp{user} specification
is ignored.

@item lxd-tramp
@cindex method @option{lxd}
@cindex @option{lxd} method
Integration for LXD containers.  A container is accessed via
@file{@trampfn{lxd,user@@container,/path/to/file}}, @samp{user} and
@samp{container} have the same meaning as in @samp{docker-tramp}.

@item magit-tramp
@cindex method @option{git}
@cindex @option{git} method
Browsing Git repositories with @code{magit}.  A versioned file is
accessed via @file{@trampfn{git,rev@@root-dir,/path/to/file}}.
@samp{rev} is a Git revision, and @samp{root-dir} is a virtual host
name for the root directory, specified in
@code{magit-tramp-hosts-alist}.

@item tramp-hdfs
@cindex method @option{hdfs}
@cindex @option{hdfs} method
Access of a hadoop/hdfs file system.  A file is accessed via
@file{@trampfn{hdfs,user@@node,/path/to/file}}, where @samp{user} is
the user that you want to use, and @samp{node} is the name of the
hadoop server.

@item vagrant-tramp
@cindex method @option{vagrant}
@cindex @option{vagrant} method
Convenience method to access vagrant boxes.  It is often used in
multi-hop file names like
@file{@value{prefix}vagrant@value{postfixhop}box|sudo@value{postfixhop}box@value{postfix}/path/to/file},
where @samp{box} is the name of the vagrant box.

@end table


@node Customizing Completion
@section Selecting config files for user/host name completion
@cindex customizing completion
@cindex selecting config files

@vindex tramp-completion-function-alist
@code{tramp-completion-function-alist} uses predefined files for user
and host name completion (@pxref{File name completion}).  For each
method, it keeps a set of configuration files and a function that can
parse that file.  Each entry in @code{tramp-completion-function-alist}
is of the form (@var{method} @var{pair1} @var{pair2} @dots{}).

Each @var{pair} is composed of (@var{function} @var{file}).
@var{function} is responsible for extracting 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
@group
(tramp-get-completion-function "rsh")

     @result{} ((tramp-parse-rhosts "/etc/hosts.equiv")
         (tramp-parse-rhosts "~/.rhosts"))
@end group
@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
@group
(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 group
@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-sconfig

This function returns the host nicknames defined by @option{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-sknownhosts

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} for host names.

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

A function which parses @file{/etc/passwd} for user names.

@item @code{tramp-parse-etc-group}
@findex tramp-parse-etc-group

A function which parses @file{/etc/group} for group names.

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

A function which parses @file{~/.netrc} and @file{~/.authinfo}-style files.

@end table

To keep a custom file with custom data in a custom structure, a custom
function has to be provided.  This function must meet the following
conventions:

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

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

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


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

To avoid repeated prompts for passwords, consider native caching
mechanisms, such as @command{ssh-agent} for @option{ssh}-like
methods, or @command{pageant} for @option{plink}-like methods.

@value{tramp} offers alternatives when native solutions cannot meet
the need.


@anchor{Using an authentication file}
@subsection Using an authentication file

@vindex auth-sources
The package @file{auth-source.el}, originally developed for No Gnus,
reads passwords from different sources, @xref{Help for users, ,
auth-source, auth}.  The default authentication file is
@file{~/.authinfo.gpg}, but this can be changed via the user option
@code{auth-sources}.

@noindent
A typical entry in the authentication file:

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

The port can take any @value{tramp} method (@pxref{Inline methods},
@pxref{External methods}).  Omitting port values matches all
@value{tramp} methods.  Domain and ports, as used in @value{tramp}
file name syntax, must be appended to the machine and login items:

@example
machine melancholia#4711 port davs login daniel%BIZARRE password geheim
@end example

@vindex auth-source-save-behavior
If there doesn't exist a proper entry, the password is read
interactively.  After successful login (verification of the password),
it is offered to save a corresponding entry for further use by
@code{auth-source} backends which support this.  This could be changed
by setting the user option @code{auth-source-save-behavior} to @code{nil}.

@vindex auth-source-debug
Set @code{auth-source-debug} to @code{t} to debug messages.

@vindex ange-ftp-netrc-filename
@strong{Note} that @file{auth-source.el} is not used for @option{ftp}
connections, because @value{tramp} passes the work to Ange FTP@.  If
you want, for example, use your @file{~/.authinfo.gpg} authentication
file, you must customize @code{ange-ftp-netrc-filename}:

@lisp
(customize-set-variable 'ange-ftp-netrc-filename "~/.authinfo.gpg")
@end lisp


@anchor{Caching passwords}
@subsection Caching passwords

@value{tramp} can cache passwords as entered and reuse when needed for
the same user or host name independent of the access method.

@vindex password-cache-expiry
@code{password-cache-expiry} sets the duration (in seconds) the
passwords are remembered.  Passwords are never saved permanently nor
can they extend beyond the lifetime of the current Emacs session.  Set
@code{password-cache-expiry} to @code{nil} to disable expiration.

@vindex password-cache
Set @code{password-cache} to @code{nil} to disable password caching.


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

@vindex tramp-persistency-file-name
For faster initial connection times, @value{tramp} stores previous
connection properties in a file specified by the user option
@code{tramp-persistency-file-name}.

The default file name for @code{tramp-persistency-file-name} is
@file{~/.emacs.d/tramp}.

@value{tramp} reads this file during Emacs startup, and writes to it
when exiting Emacs.  Delete this file for @value{tramp} to recreate a
new one on next Emacs startup.

Set @code{tramp-persistency-file-name} to @code{nil} to disable
storing connections persistently.

When @value{tramp} detects a change in the operating system version in
a remote host (via the command @command{uname -sr}), it flushes all
connection related information for that host and creates a new entry.


@node Predefined connection information
@section Setting own connection related information

For more precise customization, parameters specified by
@code{tramp-methods} can be overwritten manually.

@vindex tramp-connection-properties
Set @code{tramp-connection-properties} to manually override
@code{tramp-methods}.  Properties in this list are in the form
@code{(@var{regexp} @var{property} @var{value})}.  @var{regexp}
matches remote file names.  Use @code{nil} to match all.
@var{property} is the property's name, and @var{value} is the
property's value.

@var{property} is any method specific parameter contained in
@code{tramp-methods}.  The parameter key in @code{tramp-methods} is a
symbol name @code{tramp-<foo>}.  To overwrite that property, use the
string @t{"<foo>"} for @var{property}.  For example, this changes the
remote shell:

@lisp
@group
(add-to-list 'tramp-connection-properties
             (list (regexp-quote "@trampfn{ssh,user@@randomhost.your.domain,}")
                   "remote-shell" "/bin/ksh"))
@end group

@group
(add-to-list 'tramp-connection-properties
             (list (regexp-quote "@trampfn{ssh,user@@randomhost.your.domain,}")
                   "remote-shell-login" '("-")))
@end group
@end lisp

The parameters @code{tramp-remote-shell} and
@code{tramp-remote-shell-login} in @code{tramp-methods} now have new
values for the remote host.

@var{property} could also be any property found in
@code{tramp-persistency-file-name}.


@subsection Relevant connection properties to override

Not all connection properties need to be changed.  The most relevant
properties are listed here:

@itemize
@item @t{"login-program"}

The property @t{"login-program"} keeps the program to be called in
order to connect the remote host.  Sometimes, the program might have
another name on your host, or it is located on another path.  In this
case, you can overwrite the default value, which is special for every
connection method.  It is used in all connection methods of
@file{tramp-sh.el}.

@item @t{"login-args"}

@t{"login-args"} specifies a list of lists of arguments to pass to
@t{"login-program"}.  Read the docstring of @code{tramp-methods} how
to construct these lists.

@item @t{"remote-shell"}

This property tells Tramp which remote shell to apply on the remote
host.  It is used in all connection methods of @file{tramp-sh.el}.
The default value is @t{"/bin/sh"}.

@item @t{"remote-shell-login"}

A property to be used in conjunction with @t{"remote-shell"}.  It
specifies, which shell argument triggers a login shell.  Its default
value is @t{"-l"}, but some shells, like @command{ksh}, prefer
@t{"-"}.

@item @t{"session-timeout"}

All @file{tramp-sh.el} based methods accept the property
@t{"session-timeout"}.  This is the time (in seconds) after a
connection is disabled for security reasons, and must be
reestablished.  A value of @code{nil} disables this feature.  Most of
the methods do not set this property except the @option{sudo} and
@option{doas} methods, which use predefined values.

@item @t{"tmpdir"}

The temporary directory on the remote host.  If not specified, the
default value is @t{"/data/local/tmp"} for the @option{adb} method,
@t{"/C$/Temp"} for the @option{smb} method, and @t{"/tmp"} otherwise.

@item @t{"direct-async-process"}

When this property is non-@code{nil}, an alternative, more performant
implementation of @code{make-process} and
@code{start-file-process} is applied.  @ref{Improving performance of
asynchronous remote processes} for a discussion of constraints.

@item @t{"posix"}

Connections using the @option{smb} method check, whether the remote
host supports posix commands.  If the remote host runs Samba, it
confirms this capability.  However, some very old Samba versions have
errors in their implementation.  In order to suppress the posix
commands for those hosts, the property @t{"posix"} shall be set to
@code{nil}.

The default value of this property is @code{t} (not specified in
@code{tramp-methods}).  If the remote host runs native MS Windows,
there is no effect of this property.

@item @t{"mount-args"}@*
@t{"copyto-args"}@*
@t{"moveto-args"}

These properties keep optional flags to the different @option{rclone}
operations.  Their default value is @code{nil}.
@end itemize


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

@value{tramp} requires access to and rights to several commands on
remote hosts: @command{ls}, @command{test}, @command{find} and
@command{cat}.

Besides there are other required programs for @ref{Inline methods} and
@ref{External methods} of connection.

To improve performance and accuracy of remote file access,
@value{tramp} uses @command{perl} (or @command{perl5}) and
@command{grep} when available.

@defopt tramp-remote-path
@code{tramp-remote-path} specifies which remote directory paths
@value{tramp} can search for @ref{Remote programs}.

@vindex tramp-default-remote-path
@value{tramp} uses standard defaults, such as @file{/bin} and
@file{/usr/bin}, which are reasonable for most hosts.  To accommodate
differences in hosts and paths, for example, @file{/bin:/usr/bin} on
Debian GNU/Linux or
@file{/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/developerstudio12.6/bin} on
Solaris, @value{tramp} queries the remote host with @command{getconf
PATH} and updates the symbol @code{tramp-default-remote-path}.

For instances where hosts keep obscure locations for paths for
security reasons, manually add such paths to local @file{.emacs} as
shown below for @value{tramp} to use when connecting.

@lisp
(add-to-list 'tramp-remote-path "/usr/local/perl/bin")
@end lisp

@vindex tramp-own-remote-path
Another way to find the remote path is to use the path assigned to the
remote user by the remote host.  @value{tramp} does not normally retain
this remote path after login.  However, @code{tramp-own-remote-path}
preserves the path value, which can be used to update
@code{tramp-remote-path}.

@lisp
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
@end lisp

@strong{Note} that this works only if your remote @command{/bin/sh}
shell supports the login argument @samp{-l}.
@end defopt

Starting with @w{Emacs 26}, @code{tramp-remote-path} can be set per
host via connection-local
@ifinfo
variables, @xref{Connection Variables, , , emacs}.
@end ifinfo
@ifnotinfo
variables.
@end ifnotinfo
You could define your own search directories like this:

@lisp
@group
(connection-local-set-profile-variables 'remote-path-with-bin
   '((tramp-remote-path . ("~/bin" tramp-default-remote-path))))
@end group

@group
(connection-local-set-profile-variables 'remote-path-with-apply-pub-bin
   '((tramp-remote-path . ("/appli/pub/bin" tramp-default-remote-path))))
@end group

@group
(connection-local-set-profiles
   '(:application tramp :machine "randomhost") 'remote-path-with-bin)
@end group

@group
(connection-local-set-profiles
   '(:application tramp :user "anotheruser" :machine "anotherhost")
     'remote-path-with-apply-pub-bin)
@end group
@end lisp

When remote search paths are changed, local @value{tramp} caches must
be recomputed.  To force @value{tramp} to recompute afresh, call
@kbd{M-x tramp-cleanup-this-connection @key{RET}} or friends
(@pxref{Cleanup remote connections}).


@node Remote shell setup
@section Remote shell setup hints


@subsection Changing the default remote or local shell
@cindex zsh setup

Per default, @value{tramp} uses the command @command{/bin/sh} for
starting a shell on the remote host.  This can be changed by setting
the connection property @t{"remote-shell"}; see @pxref{Predefined
connection information}.  If you want, for example, use
@command{/usr/bin/zsh} on a remote host, you might apply

@lisp
@group
(add-to-list 'tramp-connection-properties
             (list (regexp-quote "@trampfn{ssh,user@@host,}")
                   "remote-shell" "/usr/bin/zsh"))
@end group
@end lisp

This works only for connection methods which allow to override the
remote login shell, like @option{sshx} or @option{plink}.  See
@ref{Inline methods} and @ref{External methods} for connection methods
which support this.

@vindex tramp-sh-extra-args
This approach has also the advantage, that settings in
@code{tramp-sh-extra-args} will be applied.  For @command{zsh}, the
trouble with the shell prompt due to set zle options will be avoided.

Similar problems can happen with the local shell Tramp uses to create
a process.  Per default, it uses the command @command{/bin/sh} for
this, which could also be a link to another shell.  In order to
overwrite this, you might apply

@vindex tramp-encoding-shell
@lisp
(customize-set-variable 'tramp-encoding-shell "/usr/bin/zsh")
@end lisp

This uses also the settings in @code{tramp-sh-extra-args}.


@subsection Other remote shell setup hints
@cindex remote shell setup
@cindex @file{.profile} file
@cindex @file{.login} file
@cindex shell init files

@value{tramp} checks for the availability of standard programs in the
usual locations.  Common tactics include successively trying
@command{test -e}, @command{/usr/bin/test -e}, and @command{/bin/test
-e}.  @command{ls -d} is another approach.  But these approaches do not
help with these new login patterns.

When @value{tramp} encounters two-factor logins or additional challenge
questions, such as entering birth date or security code or passphrase,
@value{tramp} needs a few more configuration steps to accommodate
them.

The difference between a password prompt and a passphrase prompt is
that the password for completing the login while the passphrase is
for authorizing access to local authentication information, such as
the ssh key.

There is no one configuration to accommodate all the variations in
login security, especially not the exotic ones.  However, @value{tramp}
provides a few tweaks to address the most common ones.

@table @asis
@item @code{tramp-shell-prompt-pattern}
@vindex tramp-shell-prompt-pattern

@code{tramp-shell-prompt-pattern} is for remote login shell prompt,
which may not be the same as the local login shell prompt,
@code{shell-prompt-pattern}.  Since most hosts use identical prompts,
@value{tramp} sets a similar default value for both prompts.

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

@value{tramp} uses @code{tramp-password-prompt-regexp} to
distinguish between prompts for passwords and prompts for passphrases.
By default, @code{tramp-password-prompt-regexp} handles the
detection in English language environments.  See a localization
example below:

@lisp
@group
(customize-set-variable
 'tramp-password-prompt-regexp
  (concat
   "^.*"
   (regexp-opt
    '("passphrase" "Passphrase"
      ;; English
      "password" "Password"
      ;; Deutsch
      "passwort" "Passwort"
      ;; Français
      "mot de passe" "Mot de passe")
    t)
   ".*:\0? *"))
@end group
@end lisp

@vindex password-word-equivalents
This user option is, by default, initialised from
@code{password-word-equivalents} when @value{tramp} is loaded, and it
is usually more convenient to add new passphrases to that user option
instead of altering this user option.

Similar localization may be necessary for handling wrong password
prompts, for which @value{tramp} uses @code{tramp-wrong-passwd-regexp}.

@item @code{tramp-terminal-type}
@vindex tramp-terminal-type
@vindex TERM@r{, environment variable}

@value{tramp} uses the user option @code{tramp-terminal-type} to set
the remote environment variable @env{TERM} for the shells it runs.
Per default, it is @t{"dumb"}, but this could be changed.  A dumb
terminal is best suited to run the background sessions of
@value{tramp}.  However, running interactive remote shells might
require a different setting.  This could be achieved by tweaking the
@env{TERM} environment variable in @code{process-environment}.

@lisp
@group
(let ((process-environment
       (cons "TERM=xterm-256color" process-environment)))
  (shell))
@end group
@end lisp

@item Determining a @value{tramp} session
@vindex TERM@r{, environment variable}
@vindex INSIDE_EMACS@r{, environment variable}

Sometimes, it is needed to identify whether a shell runs under
@value{tramp} control.  The setting of environment variable @env{TERM}
will help:

@example
@group
if test "$TERM" = "dumb"; then
   ...
fi
@end group
@end example

Another possibility is to check the environment variable
@env{INSIDE_EMACS}.  Like for all subprocesses of Emacs, this is set
to the version of the parent Emacs process, @xref{Interactive Shell, ,
, emacs}.  @value{tramp} adds its own package version to this string,
which could be used for further tests in an inferior shell.  The
string of that environment variable looks always like

@example
@group
echo $INSIDE_EMACS
@result{} 27.2,tramp:2.4.5
@end group
@end example

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

To suppress inappropriate prompts for terminal type, @value{tramp}
sets the @env{TERM} environment variable before the remote login
process begins via the user option @code{tramp-terminal-type} (see
above).  This will silence common @command{tset} related prompts.

@value{tramp}'s strategy for handling such prompts (commonly triggered
from login scripts on remote hosts) is to set the environment
variables so that no prompts interrupt the shell initialization
process.

@vindex tramp-actions-before-shell
An alternative approach is to configure @value{tramp} with strings
that can identify such questions using
@code{tramp-actions-before-shell}.  Example:

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

@group
(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"))))
@end group

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


@item Conflicting names for users and variables in @file{.profile}

When a user name is the same as a variable name in a local file, such
as @file{.profile}, then @value{tramp} may send incorrect values for
environment variables.  To avoid incorrect values, change the local
variable name to something different from the user name.  For example,
if the user name is @env{FRUMPLE}, then change the variable name to
@env{FRUMPLE_DIR}.


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

When the remote host's @file{.profile} is also used for shells other
than Bourne shell, then some incompatible syntaxes for commands in
@file{.profile} may trigger errors in Bourne shell on the host and may
not complete client's @value{tramp} connections.

One example of a Bourne shell incompatible syntax in @file{.profile}:
using @command{export FOO=bar} instead of @command{FOO=bar; export
FOO}.  After remote login, @value{tramp} will trigger an error during
its execution of @command{/bin/sh} on the remote host because Bourne
shell does not recognize the export command as entered in
@file{.profile}.

Likewise, (@code{~}) character in paths will cause errors because
Bourne shell does not do (@code{~}) character expansions.

One approach to avoiding these incompatibilities is to make all
commands in @file{~/.shrc} and @file{~/.profile} Bourne shell
compatible so @value{tramp} can complete connections to that remote.
To accommodate using non-Bourne shells on that remote, use other
shell-specific config files.  For example, bash can use
@file{~/.bash_profile} and ignore @file{.profile}.


@item Interactive shell prompt

@vindex INSIDE_EMACS@r{, environment variable}
@vindex SHELLNAME@r{, environment variable}
@vindex ESHELL@r{, environment variable}
@value{tramp} redefines the remote shell prompt internally for robust
parsing.  This redefinition affects the looks of a prompt in an
interactive remote shell through commands, such as @kbd{M-x shell
@key{RET}}.  Such prompts, however, can be reset to something more
readable and recognizable using these environment variables.

@value{tramp} sets the @env{INSIDE_EMACS} environment variable in the
startup script file @file{~/.emacs_SHELLNAME}.

@env{SHELLNAME} is @code{bash} or equivalent shell names.  Change it by
setting the environment variable @env{ESHELL} in the @file{.emacs} as
follows:

@lisp
(setenv "ESHELL" "bash")
@end lisp

Then re-set the prompt string in @file{~/.emacs_SHELLNAME} as follows:

@example
@group
# Reset the prompt for remote @value{tramp} shells.
if [ "$@{INSIDE_EMACS/*tramp*/tramp@}" == "tramp" ] ; then
   PS1="[\u@@\h \w]$ "
fi
@end group
@end example

@ifinfo
@xref{Interactive Shell, , , emacs}.
@end ifinfo

@item @command{busybox} / @command{nc}
@cindex unix command @command{nc}
@cindex @command{nc} unix command

@value{tramp}'s @option{nc} method uses the @command{nc} command to
install and execute a listener as follows (see @code{tramp-methods}):

@example
$ nc -l -p 42
@end example

The above command-line syntax has changed with @command{busybox}
versions.  If @command{nc} refuses the @samp{-p} parameter, then
overwrite as follows:

@lisp
@group
(add-to-list 'tramp-connection-properties
             `(,(regexp-quote "192.168.0.1")
               "remote-copy-args" (("-l") ("%r"))))
@end group
@end lisp

@noindent
where @samp{192.168.0.1} is the remote host IP address
(@pxref{Predefined connection information}).

@end table


@node Android shell setup
@section Android shell setup hints
@cindex android shell setup for ssh

@value{tramp} uses the @option{adb} method to access Android devices.
Android devices provide a restricted shell access through an USB
connection.  The local host must have the @command{adb} program
installed.  Usually, it is sufficient to open the file
@file{@trampfn{adb,,/}}.  Then you can navigate in the file system via
@code{dired}.

Alternatively, applications such as @code{Termux} or @code{SSHDroid}
that run @command{sshd} process on the Android device can accept any
@option{ssh}-based methods provided these settings are adjusted:

@itemize
@item
@command{sh} must be specified for remote shell since Android devices
do not provide @command{/bin/sh}.  @command{sh} will then invoke
whatever shell is installed on the device with this setting:

@lisp
@group
(add-to-list 'tramp-connection-properties
             (list (regexp-quote "192.168.0.26") "remote-shell" "sh"))
@end group
@end lisp

@noindent
where @samp{192.168.0.26} is the Android device's IP address.
(@pxref{Predefined connection information}).

@item
@value{tramp} requires preserving @env{PATH} environment variable from
user settings.  Android devices prefer @file{/system/xbin} path over
@file{/system/bin}.  Both of these are set as follows:

@lisp
@group
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
(add-to-list 'tramp-remote-path "/system/xbin")
@end group
@end lisp

@item
When the Android device is not @samp{rooted}, specify a writable
directory for temporary files:

@lisp
(add-to-list 'tramp-remote-process-environment "TMPDIR=$HOME")
@end lisp

@item
Open a remote connection with the command @kbd{C-x C-f
@trampfn{ssh,192.168.0.26#2222,} @key{RET}}, where @command{sshd} is
listening on port @samp{2222}.

To add a corresponding entry to the @file{~/.ssh/config} file
(recommended), use this:

@example
@group
Host android
     HostName 192.168.0.26
     User root
     Port 2222
@end group
@end example

@noindent
To use the host name @samp{android} instead of the IP address shown in
the previous example, fix the connection properties as follows:

@lisp
@group
(add-to-list 'tramp-connection-properties
             (list (regexp-quote "android") "remote-shell" "sh"))
@end group
@end lisp

@noindent
Open a remote connection with a more concise command @kbd{C-x C-f
@trampfn{ssh,android,} @key{RET}}.
@end itemize


@node Auto-save and Backup
@section Auto-save and Backup configuration
@cindex auto-save
@cindex backup

@vindex backup-directory-alist
To avoid @value{tramp} from saving backup files owned by @samp{root}
to locations accessible to others, default backup settings in
@code{backup-directory-alist} have to be altered.

Here's a scenario where files could be inadvertently exposed.  Emacs
by default writes backup files to the same directory as the original
files unless changed to another location, such as
@file{~/.emacs.d/backups/}.  Such a directory will also be used by
default by @value{tramp} when using, say, a restricted file
@file{@trampfn{su,root@@localhost,/etc/secretfile}}.  The backup file
of the secretfile is now owned by the user logged in from
@value{tramp} and not @samp{root}.

When @code{backup-directory-alist} is @code{nil} (the default), such
problems do not occur.

To ``turn off'' the backup feature for remote files and stop
@value{tramp} from saving to the backup directory, use this:

@lisp
@group
(add-to-list 'backup-directory-alist
             (cons tramp-file-name-regexp nil))
@end group
@end lisp

@noindent
Disabling backups can be targeted to just the @option{su} and
@option{sudo} methods:

@lisp
@group
(setq backup-enable-predicate
      (lambda (name)
        (and (normal-backup-enable-predicate name)
             (not
              (let ((method (file-remote-p name 'method)))
                (when (stringp method)
                  (member method '("su" "sudo"))))))))
@end group
@end lisp

@vindex tramp-backup-directory-alist
Another option is to create better backup file naming with user and
host names prefixed to the file name.  For example, transforming
@file{/etc/secretfile} to
@file{~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile}, set the
@value{tramp} user option @code{tramp-backup-directory-alist} from
the existing user option @code{backup-directory-alist}.

Then @value{tramp} backs up to a file name that is transformed with a
prefix consisting of the DIRECTORY name.  This file name prefixing
happens only when the DIRECTORY is an absolute local file name.

@noindent
Example:

@lisp
@group
(add-to-list 'backup-directory-alist
             (cons "." "~/.emacs.d/backups/"))
(customize-set-variable
 'tramp-backup-directory-alist backup-directory-alist)
@end group
@end lisp

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

@vindex auto-save-file-name-transforms
Just as for backup files, similar issues of file naming affect
auto-saving remote files.  Auto-saved files are saved in the directory
specified by the user option @code{auto-save-file-name-transforms}.
By default this is set to the local temporary directory.  But in some
versions of Debian GNU/Linux, this points to the source directory
where the Emacs was compiled.  Reset such values to a valid directory.

Set @code{auto-save-file-name-transforms} to @code{nil} to save
auto-saved files to the same directory as the original file.

@vindex tramp-auto-save-directory
Alternatively, set the user option @code{tramp-auto-save-directory}
to direct all auto saves to that location.


@node Keeping files encrypted
@section Protect remote files by encryption
@cindex Encrypt remote directories

@strong{Note}: File encryption in @value{tramp} is experimental, don't
use it in production systems!

Sometimes, it is desirable to protect files located on remote
directories, like cloud storages.  In order to do this, you might
instruct @value{tramp} to encrypt all files copied to a given remote
directory, and to decrypt such files when accessing.  This includes
both file contents and file names.

@value{tramp} does this transparently.  Although both files and file
names are encrypted on the remote side, they are accessible inside
Emacs as they wouldn't be transformed as such.

@cindex @command{encfs}
@cindex @command{encfsctl}
Internally, @value{tramp} uses the @command{encfs} package.
Therefore, this feature is available only if this package is installed
on the local host.  @value{tramp} does not keep and @samp{encfs
mountpoint} permanently.  Instead, it encrypts / decrypts files and
file names on the fly, using @command{encfsctl}.

@deffn Command tramp-crypt-add-directory name
This command marks the existing remote directory @var{name} for
encryption.  Files in that directory and all subdirectories will be
encrypted before copying to, and decrypted after copying from that
directory.  File and directory names will be also encrypted.
@end deffn

@defopt tramp-crypt-encfs-option
If a remote directory is marked for encryption, it is initialized via
@command{encfs} the very first time a file in this directory is
accessed.  This user option controls, which default @command{encfs}
configuration option will be selected, it can be @t{"--standard"}
or @t{"--paranoia"}.  See the @samp{encfs(1)} man page for details.

However, @value{tramp} must adapt these configuration sets.  The
@code{chainedNameIV} configuration option must be disabled; otherwise
@value{tramp} couldn't handle file name encryption transparently.
@end defopt

A password protected @option{encfs} configuration file is created the
very first time you access an encrypted remote directory.  It is kept
in your @code{user-emacs-directory} with the url-encoded directory
name as part of the basename, and @file{encfs6.xml} as suffix.  If
you, for example, mark the remote directory
@file{@trampfn{nextcloud,user@@host,/path/to/dir}} for encryption, the
configuration file is saved as
@file{tramp-%2Fnextcloud%3Auser%40host%3A%2Fpath%2Fto%2Fdir%2F.encfs6.xml}
in @code{user-emacs-directory}.  Do not loose this file and the
corresponding password; otherwise there is no way to decrypt your
encrypted files.

@defopt tramp-crypt-save-encfs-config-remote
If this user option is non-@code{nil} (the default), the @option{encfs}
configuration file @file{.encfs6.xml} is also kept in the encrypted
remote directory.  It depends on you, whether you regard the password
protection of this file as sufficient.  The advantage would be, that
such a remote directory could be accessed by different Emacs sessions,
different users, without presharing the configuration file between the
users.
@end defopt

The command @command{encfsctl}, the workhorse for encryption /
decryption, needs the configuration file password every call.
Therefore, it is recommend to cache this password in Emacs.  This can
be done using @code{auth-sources}, @ref{Using an authentication file}.
An entry needs the url-encoded directory name as machine, your local
user name as user, and the password.  The port is optional, if given
it must be the string @t{"crypt"}.  The example above would require
the following entry in the authentication file (@t{"yourname"} is the
result of @code{(user-login-name)}):

@example
machine %2Fnextcloud%3Auser%40host%3A%2Fpath%2Fto%2Fdir%2F \
        login yourname port crypt password geheim
@end example

If you use a remote file name with a quoted localname part, this
localname and the corresponding file will not be encrypted /
decrypted.  If you have an encrypted remote directory
@file{@trampfn{nextcloud,user@@host,/path/to/dir}}, the command

@example
@kbd{C-x d @trampfn{nextcloud,user@@host,/path/to/dir}}
@end example

@noindent
will show the directory listing with the plain file names, and the
command

@example
@kbd{C-x d @trampfn{nextcloud,user@@host,/:/path/to/dir}}
@end example

@noindent
will show the directory listing with the encrypted file names, and
visiting a file will show its encrypted contents.  However, it is
highly discouraged to mix encrypted and not encrypted files in the
same directory.

@deffn Command tramp-crypt-add-directory name
If a remote directory shall not include encrypted files anymore, it
must be indicated by this command.
@end deffn


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

This section is incomplete.  Please share your solutions.

@cindex method @option{sshx} with cygwin
@cindex @option{sshx} method with cygwin

Cygwin's @command{ssh} works only with a Cygwin version of Emacs.  To
check for compatibility: type @kbd{M-x eshell @key{RET}}, and start
@kbd{ssh test.host @key{RET}}.  Incompatibilities trigger this
message:

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

Some older versions of Cygwin's @command{ssh} work with the
@option{sshx} access method.  Consult Cygwin's FAQ at
@uref{https://cygwin.com/faq/} for details.

@cindex cygwin and @command{fakecygpty}
@cindex @command{fakecygpty} and cygwin

On @uref{https://www.emacswiki.org/emacs/SshWithNTEmacs, the Emacs
Wiki} it is explained how to use the helper program
@command{fakecygpty} to fix this problem.

@cindex method @option{scpx} with cygwin
@cindex @option{scpx} method with cygwin

When using the @option{scpx} access method, Emacs may call
@command{scp} with MS Windows file naming, such as @file{c:/foo}.  But
the version of @command{scp} that is installed with Cygwin does not
know about MS Windows file naming, which causes it to incorrectly look
for a host named @samp{c}.

A workaround: write a wrapper script for @option{scp} to convert
Windows file names to Cygwin file names.

@cindex cygwin and @command{ssh-agent}
@cindex @env{SSH_AUTH_SOCK} and emacs on ms windows
@vindex SSH_AUTH_SOCK@r{, environment variable}

When using the @command{ssh-agent} on MS Windows for password-less
interaction, @option{ssh} methods depend on the environment variable
@env{SSH_AUTH_SOCK}.  But this variable is not set when Emacs is
started from a Desktop shortcut and authentication fails.

One workaround is to use an MS Windows based SSH Agent, such as
Pageant.  It is part of the Putty Suite of tools.

The fallback is to start Emacs from a shell.


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

@value{tramp} operates transparently, accessing remote files as if
they are local.  However, @value{tramp} employs a formalized remote
file naming syntax to perform its functions transparently.  This
syntax consists of many parts specifying access methods,
authentication, host names, and file names.  Ange FTP uses a similar
syntax.

@cindex type-ahead

Unlike opening local files in Emacs, which are instantaneous, opening
remote files in @value{tramp} is slower at first.  Sometimes there is
a noticeable delay before the prompts for passwords or authentication
appear in the minibuffer.  Hitting @kbd{@key{RET}} or other keys
during this gap will be processed by Emacs.  This type-ahead facility
is a feature of Emacs that may cause missed prompts when using
@value{tramp}.

@menu
* File name syntax::            @value{tramp} file name conventions.
@ifset unified
* Change file name syntax::     Alternative file name syntax.
@end ifset
* File name completion::        File name completion.
* Ad-hoc multi-hops::           Declaring multiple hops in the file name.
* Remote processes::            Integration with other Emacs packages.
* Cleanup remote connections::  Cleanup remote connections.
* Renaming remote files::       Renaming remote files.
* Archive file names::          Access to files in file archives.
@end menu


@node File name syntax
@section @value{tramp} file name conventions
@cindex file name syntax
@cindex file name examples

@file{@trampfn{method,host,/path/to/file}} opens file @var{/path/to/file}
on the remote host @var{host}, using the method @var{method}.

@table @file
@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}.emacs
For the file @file{.emacs} located in the home directory, on the host
@code{melancholia}, using method @code{ssh}.

@item @value{prefix}ssh@value{postfixhop}melancholia.danann.net@value{postfix}.emacs
For the file @file{.emacs} specified using the fully qualified domain name of
the host.

@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}~/.emacs
For the file @file{.emacs} specified using the @file{~}, which is expanded.

@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}~daniel/.emacs
For the file @file{.emacs} located in @code{daniel}'s home directory
on the host, @code{melancholia}.  The @file{~<user>} construct is
expanded to the home directory of that user on the remote host.

@item @value{prefix}ssh@value{postfixhop}melancholia@value{postfix}/etc/squid.conf
For the file @file{/etc/squid.conf} on the host @code{melancholia}.

@end table

@var{host} can take IPv4 or IPv6 address, as in
@file{@trampfn{ssh,127.0.0.1,.emacs}} or
@file{@trampfn{ssh,@value{ipv6prefix}::1@value{ipv6postfix},.emacs}}.
@ifset unified
For syntactical reasons, IPv6 addresses must be embedded in square
brackets @file{@value{ipv6prefix}} and @file{@value{ipv6postfix}}.
@end ifset

By default, @value{tramp} will use the current local user name as the
remote user name for log in to the remote host.  Specifying a different
name using the proper syntax will override this default behavior:

@example
@trampfn{method,user@@host,path/to/file}
@end example

@file{@trampfn{ssh,daniel@@melancholia,.emacs}} is for file
@file{.emacs} in @code{daniel}'s home directory on the host,
@code{melancholia}, accessing via method @code{ssh}.

For specifying port numbers, affix @file{#<port>} to the host
name.  For example: @file{@trampfn{ssh,daniel@@melancholia#42,.emacs}}.

All method, user name, host name, port number and local name parts are
optional, @xref{Default Method}, @xref{Default User}, @xref{Default Host}.
@ifset unified
For syntactical reasons, the default method must be indicated by the
pseudo method @file{-}.
@end ifset


@ifset unified
@node Change file name syntax
@section Alternative file name syntax
@cindex change file name syntax
@cindex alternative file name syntax

The syntax described in @ref{File name syntax} is the @code{default}
syntax, which is active after Emacs startup.  However, this can be
changed.

@deffn Command tramp-change-syntax syntax
This command changes the syntax @value{tramp} uses for remote file
names.  Beside the @code{default} value, @var{syntax} can be

@itemize
@item @code{simplified}
@cindex simplified syntax

The remote file name syntax is similar to the syntax used by Ange FTP@.
A remote file name has the form
@code{@value{prefix}user@@host@value{postfix}path/to/file}.  The
@code{user@@} part is optional, and the method is determined by
@ref{Default Method}.

@item @code{separate}
@cindex separate syntax

@clear unified
@set separate
@include trampver.texi
The remote file name syntax is similar to the syntax used by XEmacs.
A remote file name has the form
@code{@trampfn{method,user@@host,path/to/file}}.  The @code{method}
and @code{user@@} parts are optional.
@clear separate
@set unified
@include trampver.texi
@end itemize
@end deffn

@defvar tramp-file-name-regexp
This variable keeps a regexp which matches the selected remote file
name syntax.  Its value changes after every call of
@code{tramp-change-syntax}.  However, it is not recommended to use
this variable in external packages, a call of @code{file-remote-p} is
much more appropriate.
@ifinfo
@pxref{Magic File Names, , , elisp}.
@end ifinfo
@end defvar
@end ifset


@node File name completion
@section File name completion
@cindex file name completion

@value{tramp} can complete the following @value{tramp} file name
components: method names, user names, host names, and file names
located on remote hosts.  User name and host name completion is
activated only, if file name completion has one of the styles
@code{basic}, @code{emacs21}, or @code{emacs22}.
@ifinfo
@xref{Completion Styles, , , emacs}.
@end ifinfo

For example, type @kbd{C-x C-f @value{prefixwithspace} s @key{TAB}},
@value{tramp} completion choices show up as

@example
@group
@multitable @columnfractions .2 .2 .2 .2 .2
@item @c
  sbin/ @tab @c
  @value{prefixhop}scp@value{postfix} @tab @c
  @value{prefixhop}scpx@value{postfix} @tab @c
  @value{prefixhop}sftp@value{postfix} @tab @c
  @value{prefixhop}sg@value{postfix}
@item @c
  @value{prefixhop}smb@value{postfix} @tab @c
  srv/ @tab @c
  @value{prefixhop}ssh@value{postfix} @tab @c
  @value{prefixhop}sshx@value{postfix} @tab @c
  @value{prefixhop}su@value{postfix}
@item @c
  @value{prefixhop}sudo@value{postfix} @tab @c
  sys/
@end multitable
@end group
@end example

@samp{@value{prefixhop}ssh@value{postfixhop}} is a possible
completion for the respective method, and @samp{sbin/} stands for the
directory @file{/sbin} on your local host.

Type @kbd{s h @value{postfixhop}} for the minibuffer completion to
@samp{@value{prefix}ssh@value{postfixhop}}.  Typing @kbd{@key{TAB}}
shows host names @value{tramp} extracts from @file{~/.ssh/config}
file, for example.

@example
@group
@multitable @columnfractions .5 .5
@item @c
  @value{prefixhop}ssh@value{postfixhop}127.0.0.1@value{postfix} @tab @c
  @value{prefixhop}ssh@value{postfixhop}192.168.0.1@value{postfix}
@item @c
  @value{prefixhop}ssh@value{postfixhop}@value{ipv6prefix}::1@value{ipv6postfix}@value{postfix} @tab @c
  @value{prefixhop}ssh@value{postfixhop}localhost@value{postfix}
@item @c
  @value{prefixhop}ssh@value{postfixhop}melancholia.danann.net@value{postfix} @tab @c
  @value{prefixhop}ssh@value{postfixhop}melancholia@value{postfix}
@end multitable
@end group
@end example

Choose a host from the above list and then continue to complete file
names on that host.

When the configuration (@pxref{Customizing Completion}) includes user
names, then the completion lists will account for the user names as well.

@vindex tramp-completion-use-auth-sources
Results from @code{auth-sources} search (@pxref{Using an
authentication file}) are added to the completion candidates.  This
search could be annoying, for example due to a passphrase request of
the @file{~/.authinfo.gpg} authentication file.  The user option
@code{tramp-completion-use-auth-sources} controls, whether such a
search is performed during completion.

Remote hosts previously visited or hosts whose connections are kept
persistently (@pxref{Connection caching}) will be included in the
completion lists.

After remote host name completion comes completion of file names on
the remote host.  It works the same as with local host file completion
except that killing with double-slash @file{//} kills only the file
name part of the @value{tramp} file name syntax.  A triple-slash
stands for the default behavior.
@ifinfo
@xref{Minibuffer File, , , emacs}.
@end ifinfo

@noindent
Example:

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

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

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


@node Ad-hoc multi-hops
@section Declaring multiple hops in the file name
@cindex multi-hop, ad-hoc
@cindex proxy hosts, ad-hoc

@value{tramp} file name syntax can accommodate ad-hoc specification of
multiple proxies without using @code{tramp-default-proxies-alist}
configuration setup (@pxref{Multi-hops}).

Each proxy is specified using the same syntax as the remote host
specification minus the file name part.  Each hop is separated by a
@samp{|}.  Chain the proxies from the starting host to the destination
remote host name and file name.  For example, hopping over a single
proxy @samp{bird@@bastion} to a remote file on @samp{you@@remotehost}:

@example
@c @kbd{C-x C-f @trampfn{ssh@value{postfixhop}bird@@bastion|ssh,you,remotehost,/path} @key{RET}}
@kbd{C-x C-f @value{prefix}ssh@value{postfixhop}bird@@bastion|ssh@value{postfixhop}you@@remotehost@value{postfix}/path @key{RET}}
@end example

Each involved method must be an inline method (@pxref{Inline methods}).

@value{tramp} adds the ad-hoc definitions on the fly to
@code{tramp-default-proxies-alist} and is available for re-use during
that Emacs session.  Subsequent @value{tramp} connections to the same
remote host can then use the shortcut form:
@samp{@trampfn{ssh,you@@remotehost,/path}}.  Ad-hoc definitions are
removed from @code{tramp-default-proxies-alist} via the command
@kbd{M-x tramp-cleanup-all-connections @key{RET}} (@pxref{Cleanup
remote connections}).

@defopt tramp-save-ad-hoc-proxies
For ad-hoc definitions to be saved automatically in
@code{tramp-default-proxies-alist} for future Emacs sessions, set
@code{tramp-save-ad-hoc-proxies} to non-@code{nil}.

@lisp
(customize-set-variable 'tramp-save-ad-hoc-proxies t)
@end lisp
@end defopt

Ad-hoc proxies can take patterns @code{%h} or @code{%u} like in
@code{tramp-default-proxies-alist}.  The following file name expands
to user @code{root} on host @code{remotehost}, starting with an
@option{ssh} session on host @code{remotehost}:
@samp{@value{prefix}ssh@value{postfixhop}%h|su@value{postfixhop}remotehost@value{postfix}}.

On the other hand, if a trailing hop does not specify a host name,
the host name of the previous hop is reused. Therefore, the following
file name is equivalent to the previous example:
@samp{@value{prefix}ssh@value{postfixhop}remotehost|su@value{postfixhop}@value{postfix}}.


@node Remote processes
@section Integration with other Emacs packages
@cindex @code{compile}
@cindex @code{recompile}

@value{tramp} supports starting new running processes on the remote
host for discovering remote file names.  Emacs packages on the remote
host need no specific modifications for @value{tramp}'s use.

This type of integration does not work with the @option{ftp} method,
and does not support the pty association as specified in
@code{start-file-process}.

@code{process-file} and @code{start-file-process} work on the remote
host when the variable @code{default-directory} is remote:

@lisp
@group
(let ((default-directory "/ssh:remote.host:"))
  (start-file-process "grep" (get-buffer-create "*grep*")
                      "/bin/sh" "-c" "grep -e tramp *"))
@end group
@end lisp

@vindex process-file-return-signal-string
@code{process-file} shall return either the exit code of the process,
or a string describing the signal, when the process has been
interrupted.  Since it cannot be determined reliably whether a remote
process has been interrupted, @code{process-file} returns always the
exit code.  When the user option
@code{process-file-return-signal-string} is non-@code{nil},
@code{process-file} regards all exit codes greater than 128 as an
indication that the process has been interrupted, and returns a
respective string.

Remote processes do not apply to @acronym{GVFS} (see @ref{GVFS-based
methods}) because the remote file system is mounted on the local host
and @value{tramp} just accesses by changing the
@code{default-directory}.

@value{tramp} starts a remote process when a command is executed in a
remote file or directory buffer.  As of now, these packages have been
integrated to work with @value{tramp}: @file{shell.el},
@file{eshell.el}, @file{compile.el} (commands like @code{compile} and
@code{grep}) and @file{gud.el} (@code{gdb} or @code{perldb}).

@vindex INSIDE_EMACS@r{, environment variable}
@value{tramp} always modifies the @env{INSIDE_EMACS} environment
variable for remote processes.  Per default, this environment variable
shows the Emacs version.  @value{tramp} adds its own version string,
so it looks like @samp{27.2,tramp:2.4.5.1}.  However, other packages
might also add their name to this environment variable, like
@samp{27.2,comint,tramp:2.4.5.1}.

For @value{tramp} to find the command on the remote, it must be
accessible through the default search path as setup by @value{tramp}
upon first connection.  Alternatively, use an absolute path or extend
@code{tramp-remote-path} (see @ref{Remote programs}):

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

@vindex tramp-remote-process-environment
Customize user option @code{tramp-remote-process-environment} to
suit the remote program's environment for the remote host.
@code{tramp-remote-process-environment} is a list of strings
structured similar to @code{process-environment}, where each element
is a string of the form @samp{ENVVARNAME=VALUE}.

To avoid any conflicts with local host environment variables set
through local configuration files, such as @file{~/.profile}, use
@samp{ENVVARNAME=} to unset them for the remote environment.

@noindent
Use @code{add-to-list} to add entries:

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

@vindex HISTORY@r{, environment variable}
Modifying or deleting already existing values in the
@code{tramp-remote-process-environment} list may not be feasible on
restricted remote hosts.  For example, some system administrators
disallow changing @env{HISTORY} environment variable.  To accommodate
such restrictions when using @value{tramp}, fix the
@code{tramp-remote-process-environment} by the following code in the
local @file{.emacs} file:

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

@vindex ENV@r{, environment variable}
Setting the @env{ENV} environment variable instructs some shells to
read an initialization file.  Per default, @value{tramp} has disabled
this.  You could overwrite this behavior by evaluating

@lisp
@group
(let ((process-environment tramp-remote-process-environment))
  (setenv "ENV" "$HOME/.profile")
  (setq tramp-remote-process-environment process-environment))
@end group
@end lisp

In addition to @code{tramp-remote-process-environment}, you can set
environment variables for individual remote process calls by
let-binding @code{process-environment}.  @value{tramp} applies any
entries not present in the global default value of
@code{process-environment} (overriding
@code{tramp-remote-process-environment} settings, if they conflict).
For example:

@lisp
@group
(let ((process-environment (cons "HGPLAIN=1" process-environment)))
  (process-file @dots{}))
@end group
@end lisp

@vindex HGPLAIN@r{, environment variable}
Let-binding in this way works regardless of whether the process to be
called is local or remote, since @value{tramp} would add just the
@env{HGPLAIN} setting and local processes would take whole value of
@code{process-environment} along with the new value of @env{HGPLAIN}.

For integrating other Emacs packages so @value{tramp} can execute
remotely, please file a bug report.  @xref{Bug Reports}.


@subsection Running remote programs that create local X11 windows

@vindex DISPLAY@r{, environment variable}
To allow a remote program to create an X11 window on the local host,
set the @env{DISPLAY} environment variable for the remote host as
follows in the local @file{.emacs} file:

@lisp
@group
(add-to-list 'tramp-remote-process-environment
             (format "DISPLAY=%s" (getenv "DISPLAY")))
@end group
@end lisp

@noindent
@code{(getenv "DISPLAY")} should return a recognizable name for the
local host that the remote host can redirect X11 window
interactions.  If querying for a recognizable name is not possible for
whatever reason, then replace @code{(getenv "DISPLAY")} with a
hard-coded, fixed name.  Note that using @code{:0} for X11 display name
here will not work as expected.

An alternate approach is specify @option{ForwardX11 yes} or
@option{ForwardX11Trusted yes} in @file{~/.ssh/config} on the local
host.


@subsection Running @code{shell} on a remote host
@cindex @code{shell}

Set @code{explicit-shell-file-name} to the appropriate shell name
when using @value{tramp} between two hosts with different operating
systems, such as @samp{windows-nt} and @samp{gnu/linux}.  This option
ensures the correct name of the remote shell program.

When @code{explicit-shell-file-name} is equal to @code{nil}, calling
@code{shell} interactively will prompt for a shell name.

Starting with @w{Emacs 26}, you could use connection-local variables
for setting different values of @code{explicit-shell-file-name} for
different remote hosts.
@ifinfo
@xref{Connection Variables, , , emacs}.
@end ifinfo

@lisp
@group
(connection-local-set-profile-variables
  'remote-bash
  '((explicit-shell-file-name . "/bin/bash")
    (explicit-bash-args . ("-i"))))
@end group

@group
(connection-local-set-profile-variables
  'remote-ksh
  '((explicit-shell-file-name . "/bin/ksh")
    (explicit-ksh-args . ("-i"))))
@end group

@group
(connection-local-set-profiles
  '(:application tramp :protocol "ssh" :machine "localhost")
  'remote-bash)
@end group

@group
(connection-local-set-profiles
  `(:application tramp :protocol "sudo"
    :user "root" :machine ,(system-name))
  'remote-ksh)
@end group
@end lisp


@subsection Running @code{shell-command} on a remote host
@cindex @code{shell-command}

@code{shell-command} executes commands synchronously or asynchronously
on remote hosts and displays output in buffers on the local
host.  Example:

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

@command{tail} command outputs continuously to the local buffer whose
name is the value of the variable @code{shell-command-buffer-name-async}.

@kbd{M-x auto-revert-tail-mode @key{RET}} runs similarly showing
continuous output.

@vindex shell-file-name
@vindex shell-command-switch
@code{shell-command} uses the user option @code{shell-file-name} and
the variable @code{shell-command-switch} in order to determine which
shell to run.  For remote hosts, their default values are
@file{/bin/sh} and @option{-c}, respectively (except for the
@option{adb} method, which uses @file{/system/bin/sh}).  Like the
variables in the previous section, these variables can be changed via
connection-local variables.

@vindex async-shell-command-width
@vindex COLUMNS@r{, environment variable}
If Emacs supports the user option @code{async-shell-command-width}
(since @w{Emacs 27}), @value{tramp} cares about its value for
asynchronous shell commands.  It specifies the number of display
columns for command output.  For synchronous shell commands, a similar
effect can be achieved by adding the environment variable
@env{COLUMNS} to @code{tramp-remote-process-environment}.


@subsection Running @code{eshell} on a remote host
@cindex @code{eshell}

@value{tramp} is integrated into @file{eshell.el}, which enables
interactive eshell sessions on remote hosts at the command prompt.
You must add the module @code{eshell-tramp} to
@code{eshell-modules-list}.  Here's a sample interaction after opening
@kbd{M-x eshell @key{RET}} on a remote host:

@example
@group
@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 group
@end example

@code{eshell} added custom @code{su} and @code{sudo} commands that set
the default directory correctly for the @file{*eshell*} buffer.
@value{tramp} silently updates @code{tramp-default-proxies-alist}
with an entry for this directory (@pxref{Multi-hops}):

@example
@group
@b{~ $} cd @trampfn{ssh,user@@remotehost,/etc} @key{RET}
@b{@trampfn{ssh,user@@remotehost,/etc} $} find-file shadow @key{RET}
File is not readable: @trampfn{ssh,user@@remotehost,/etc/shadow}
@b{@trampfn{ssh,user@@remotehost,/etc} $} sudo find-file shadow @key{RET}
#<buffer shadow>
@end group

@group
@b{@trampfn{ssh,user@@remotehost,/etc} $} su - @key{RET}
@b{@trampfn{su,root@@remotehost,/root} $} id @key{RET}
uid=0(root) gid=0(root) groups=0(root)
@b{@trampfn{su,root@@remotehost,/root} $}
@end group
@end example


@anchor{Running a debugger on a remote host}
@subsection Running a debugger on a remote host
@cindex @file{gud.el}
@cindex @code{gdb}
@cindex @code{perldb}

@file{gud.el} provides a unified interface to symbolic debuggers
@ifinfo
(@ref{Debuggers, , , emacs}).
@end ifinfo
@value{tramp} can run debug on remote hosts by calling @code{gdb}
with a remote file name:

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

Since the remote @code{gdb} and @code{gdb-inferior} processes do not
belong to the same process group on the remote host, there will be a
warning, which can be ignored:

@example
&"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
@end example

@noindent
As consequence, there will be restrictions in I/O of the process to be
debugged.

Relative file names are based on the remote default directory.  When
@file{myprog.pl} exists in @file{@trampfn{ssh,host,/home/user}}, valid
calls include:

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

Just the local part of a remote file name, such as @command{perl -d
/home/user/myprog.pl}, is not possible.

Arguments of the program to be debugged must be literal, can take
relative or absolute paths, but not remote paths.


@subsection Running remote processes on MS Windows hosts
@cindex @command{winexe}
@cindex @command{powershell}

@command{winexe} runs processes on a remote MS Windows host, and
@value{tramp} can use it for @code{process-file} and
@code{start-file-process}.

@code{tramp-smb-winexe-program} specifies the local @command{winexe}
command.  Powershell V2.0 on the remote host is required to run
processes triggered from @value{tramp}.

@code{explicit-shell-file-name} and @code{explicit-*-args} have to
be set properly so @kbd{M-x shell @key{RET}} can open a proper remote
shell on a MS Windows host.  To open @command{cmd}, set it as follows:

@lisp
@group
(setq explicit-shell-file-name "cmd"
      explicit-cmd-args '("/q"))
@end group
@end lisp

@noindent
To open @command{powershell} as a remote shell, use this:

@lisp
@group
(setq explicit-shell-file-name "powershell"
      explicit-powershell-args '("-file" "-"))
@end group
@end lisp


@anchor{Improving performance of asynchronous remote processes}
@subsection Improving performance of asynchronous remote processes
@cindex Asynchronous remote processes
@findex make-process
@findex start-file-process

@value{tramp}'s implementation of @code{make-process} and
@code{start-file-process} requires a serious overhead for
initialization, every process invocation.  This is needed for handling
interactive dialogues when connecting the remote host (like providing
a password), and initial environment setup.

Sometimes, this is not needed.  Instead of starting a remote shell and
running the command afterwards, it is sufficient to run the command
directly.  @value{tramp} supports this by an alternative
implementation of @code{make-process} and @code{start-file-process}.
This is triggered by the connection property
@t{"direct-async-process"}, @xref{Predefined connection information},
which must be set to a non-@code{nil} value.  Example:

@lisp
@group
(add-to-list 'tramp-connection-properties
             (list (regexp-quote "@trampfn{ssh,user@@host,}")
                   "direct-async-process" t))
@end group
@end lisp

Using direct asynchronous processes in @value{tramp} is not possible,
if the remote host is connected via multiple hops
(@pxref{Multi-hops}).  In this case, @value{tramp} falls back to its
classical implementation.

Furthermore, this approach has the following limitations:

@itemize
@item
It works only for connection methods defined in @file{tramp-sh.el} and
@file{tramp-adb.el}.

@item
It does not support interactive user authentication.  With
@option{ssh}-based methods, this can be avoided by using a password
agent like @command{ssh-agent}, using public key authentication, or
using @option{ControlMaster} options.

@item
It cannot be killed via @code{interrupt-process}.

@item
It does not report the remote terminal name via @code{process-tty-name}.

@item
It does not set process property @code{remote-pid}.

@item
It does not use @code{tramp-remote-path} and
@code{tramp-remote-process-environment}.
@end itemize

In order to gain even more performance, it is recommended to bind
@code{tramp-verbose} to 0 when running @code{make-process} or
@code{start-file-process}.  Furthermore, you might set
@code{tramp-use-ssh-controlmaster-options} to @code{nil} in order to
bypass @value{tramp}'s handling of the @option{ControlMaster} options,
and use your own settings in @file{~/.ssh/config}.


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

@value{tramp} provides several ways to flush remote connections.

@deffn Command tramp-cleanup-connection vec &optional keep-debug keep-password
This command flushes all connection related objects.  @var{vec} is the
internal representation of a remote connection.  When called
interactively, this command lists active remote connections in the
minibuffer.  Each connection is of the format
@file{@trampfn{method,user@@host,}}.

Flushing remote connections also cleans the password cache
(@pxref{Password handling}), file cache, connection cache
(@pxref{Connection caching}), and recentf cache (@pxref{File
Conveniences, , , emacs}).  It also deletes session timers
(@pxref{Predefined connection information}) and connection buffers.

If @var{keep-debug} is non-@code{nil}, the debug buffer is kept.  A
non-@code{nil} @var{keep-password} preserves the password cache.
@end deffn

@deffn Command tramp-cleanup-this-connection
Flushes the current buffer's remote connection objects, the same as in
@code{tramp-cleanup-connection}.
@end deffn

@deffn Command tramp-cleanup-all-connections
Flushes all active remote connection objects, the same as in
@code{tramp-cleanup-connection}.  This command removes also ad-hoc
proxy definitions (@pxref{Ad-hoc multi-hops}).

@end deffn

@deffn Command tramp-cleanup-all-buffers
Just as for @code{tramp-cleanup-all-connections}, all remote
connections and ad-hoc proxy definition are cleaned up in addition to
killing all buffers related to remote connections.
@end deffn


@node Renaming remote files
@section Renaming remote files
@cindex save remote files

Sometimes, it is desirable to safe file contents of buffers visiting a
given remote host.  This could happen for example, if the local host
changes its network integration, and the remote host is not reachable
anymore.

@deffn Command tramp-rename-files source target
Replace in all buffers the visiting file name from @var{source} to
@var{target}.  @var{source} is a remote directory name, which could
contain also a localname part.  @var{target} is the directory name
@var{source} is replaced with.  Often, @var{target} is a remote
directory name on another host, but it can also be a local directory
name.  If @var{target} has no local part, the local part from
@var{source} is used.

If @var{target} is @code{nil}, it is selected according to the first
match in @code{tramp-default-rename-alist}.  If called interactively,
this match is offered as initial value for selection.

On all buffers, which have a @code{buffer-file-name} matching
@var{source}, this name is modified by replacing @var{source} with
@var{target}.  This is applied by calling
@code{set-visited-file-name}.  The new @code{buffer-file-name} is
prompted for modification in the minibuffer.  The buffers are marked
modified, and must be saved explicitly.

If user option @code{tramp-confirm-rename-file-names} is @code{nil},
changing the file name happens without confirmation.  This requires a
matching entry in @code{tramp-default-rename-alist}.

Remote buffers related to the remote connection identified by
@var{source}, which are not visiting files, or which are visiting
files not matching @var{source}, are not modified.

Interactively, @var{target} is selected from
@code{tramp-default-rename-alist} without confirmation if the prefix
argument is non-@code{nil}.

The remote connection identified by @var{source} is flushed by
@code{tramp-cleanup-connection}.
@end deffn

@deffn Command tramp-rename-these-files target
Replace visiting file names to @var{target}.  The current buffer must
be related to a remote connection.  In all buffers, which are visiting
a file with the same directory name, the buffer file name is changed.

Interactively, @var{target} is selected from
@code{tramp-default-rename-alist} without confirmation if the prefix
argument is non-@code{nil}.
@end deffn

@defopt tramp-default-rename-alist
The default target for renaming remote buffer file names.  This is an
alist of cons cells @code{(source . target)}.  The first matching item
specifies the target to be applied for renaming buffer file names from
source via @code{tramp-rename-files}.  @code{source} is a regular
expressions, which matches a remote file name.  @code{target} must be
a directory name, which could be remote (including remote directories
Tramp infers by default, such as @samp{@trampfn{method,user@@host,}}).

@code{target} can contain the patterns @code{%m}, @code{%u} or
@code{%h}, which are replaced by the method name, user name or host
name of @code{source} when calling @code{tramp-rename-files}.

@code{source} could also be a Lisp form, which will be evaluated.  The
result must be a string or @code{nil}, which is interpreted as a
regular expression which always matches.

Example entries:

@lisp
@group
("@trampfn{ssh,badhost,/path/to/dir/}"
 . "@trampfn{ssh,goodhost,/path/to/another/dir/}")
@end group
@end lisp

would trigger renaming of buffer file names on @samp{badhost} to
@samp{goodhost}, including changing the directory name.

@lisp
("@trampfn{ssh,.+\\\\.company\\\\.org,}" . "@value{prefix}ssh@value{postfixhop}multi.hop|ssh@value{postfixhop}%h@value{postfix}")
@end lisp

routes all connections to a host in @samp{company.org} via
@samp{@trampfn{ssh,multi.hop,}}, which might be useful when using
Emacs outside the company network.

@lisp
(nil . "~/saved-files/%m:%u@@%h/")
@end lisp

saves all remote files locally, with a directory name including method
name, user name and host name of the remote connection.
@end defopt

@defopt tramp-confirm-rename-file-names
Whether renaming a buffer file name by @code{tramp-rename-files} or
@code{tramp-rename-these-files} must be confirmed.
@end defopt


@node Archive file names
@section Archive file names
@cindex file archives
@cindex archive file names
@cindex method archive
@cindex archive method

@value{tramp} offers also transparent access to files inside file
archives.  This is possible only on hosts which have installed
@acronym{GVFS, the GNOME Virtual File System}, @ref{GVFS-based
methods}.  Internally, file archives are mounted via the
@acronym{GVFS} @option{archive} method.

A file archive is a regular file of kind @file{/path/to/dir/file.EXT}.
The extension @samp{.EXT} identifies the type of the file archive.  A
file inside a file archive, called archive file name, has the name
@file{/path/to/dir/file.EXT/dir/file}.

Most of the @ref{Magic File Names, , magic file name operations,
elisp}, are implemented for archive file names, exceptions are all
operations which write into a file archive, and process related
operations.  Therefore, functions like

@lisp
(copy-file "/path/to/dir/file.tar/dir/file" "/somewhere/else")
@end lisp

@noindent
work out of the box.  This is also true for file name completion, and
for libraries like @code{dired} or @code{ediff}, which accept archive
file names as well.

@vindex tramp-archive-suffixes
File archives are identified by the file name extension @samp{.EXT}.
Since @acronym{GVFS} uses internally the library @code{libarchive(3)},
all suffixes, which are accepted by this library, work also for
archive file names.  Accepted suffixes are listed in the constant
@code{tramp-archive-suffixes}.  They are

@itemize
@item @samp{.7z} ---
7-Zip archives
@cindex @file{7z} file archive suffix
@cindex file archive suffix @file{7z}

@item @samp{.apk} ---
Android package kits
@cindex @file{apk} file archive suffix
@cindex file archive suffix @file{apk}

@item @samp{.ar} ---
UNIX archiver formats
@cindex @file{ar} file archive suffix
@cindex file archive suffix @file{ar}

@item @samp{.cab}, @samp{.CAB} ---
Microsoft Windows cabinets
@cindex @file{cab} file archive suffix
@cindex @file{CAB} file archive suffix
@cindex file archive suffix @file{cab}
@cindex file archive suffix @file{CAB}

@item @samp{.cpio} ---
CPIO archives
@cindex @file{cpio} file archive suffix
@cindex file archive suffix @file{cpio}

@item @samp{.deb} ---
Debian packages
@cindex @file{deb} file archive suffix
@cindex file archive suffix @file{deb}

@item @samp{.depot} ---
HP-UX SD depots
@cindex @file{depot} file archive suffix
@cindex file archive suffix @file{depot}

@item @samp{.exe} ---
Self extracting Microsoft Windows EXE files
@cindex @file{exe} file archive suffix
@cindex file archive suffix @file{exe}

@item @samp{.iso} ---
ISO 9660 images
@cindex @file{iso} file archive suffix
@cindex file archive suffix @file{iso}

@item @samp{.jar} ---
Java archives
@cindex @file{jar} file archive suffix
@cindex file archive suffix @file{jar}

@item @samp{.lzh}, @samp{.LZH} ---
Microsoft Windows compressed LHA archives
@cindex @file{lzh} file archive suffix
@cindex @file{LZH} file archive suffix
@cindex file archive suffix @file{lzh}
@cindex file archive suffix @file{LZH}

@item @samp{.msu}, @samp{.MSU} ---
Microsoft Windows Update packages
@cindex @file{msu} file archive suffix
@cindex @file{MSU} file archive suffix
@cindex file archive suffix @file{msu}
@cindex file archive suffix @file{MSU}

@item @samp{.mtree} ---
BSD mtree format
@cindex @file{mtree} file archive suffix
@cindex file archive suffix @file{mtree}

@item @samp{.odb}, @samp{.odf}, @samp{.odg}, @samp{.odp}, @samp{.ods},
@samp{.odt} ---
OpenDocument formats
@cindex @file{odb} file archive suffix
@cindex @file{odf} file archive suffix
@cindex @file{odg} file archive suffix
@cindex @file{odp} file archive suffix
@cindex @file{ods} file archive suffix
@cindex @file{odt} file archive suffix
@cindex file archive suffix @file{odb}
@cindex file archive suffix @file{odf}
@cindex file archive suffix @file{odg}
@cindex file archive suffix @file{odp}
@cindex file archive suffix @file{ods}
@cindex file archive suffix @file{odt}

@item @samp{.pax} ---
Posix archives
@cindex @file{pax} file archive suffix
@cindex file archive suffix @file{pax}

@item @samp{.rar} ---
RAR archives
@cindex @file{rar} file archive suffix
@cindex file archive suffix @file{rar}

@item @samp{.rpm} ---
Red Hat packages
@cindex @file{rpm} file archive suffix
@cindex file archive suffix @file{rpm}

@item @samp{.shar} ---
Shell archives
@cindex @file{shar} file archive suffix
@cindex file archive suffix @file{shar}

@item @samp{.tar}, @samp{.tbz}, @samp{.tgz}, @samp{.tlz}, @samp{.txz},
@samp{.tzst} ---
(Compressed) tape archives
@cindex @file{tar} file archive suffix
@cindex @file{tbz} file archive suffix
@cindex @file{tgz} file archive suffix
@cindex @file{tlz} file archive suffix
@cindex @file{txz} file archive suffix
@cindex @file{tzst} file archive suffix
@cindex file archive suffix @file{tar}
@cindex file archive suffix @file{tbz}
@cindex file archive suffix @file{tgz}
@cindex file archive suffix @file{tlz}
@cindex file archive suffix @file{txz}
@cindex file archive suffix @file{tzst}

@item @samp{.warc} ---
Web archives
@cindex @file{warc} file archive suffix
@cindex file archive suffix @file{warc}

@item @samp{.xar} ---
macOS XAR archives
@cindex @file{xar} file archive suffix
@cindex file archive suffix @file{xar}

@item @samp{.xpi} ---
XPInstall Mozilla addons
@cindex @file{xpi} file archive suffix
@cindex file archive suffix @file{xpi}

@item @samp{.xps} ---
Open XML Paper Specification (OpenXPS) documents
@cindex @file{xps} file archive suffix
@cindex file archive suffix @file{xps}

@item @samp{.zip}, @samp{.ZIP} ---
ZIP archives
@cindex @file{zip} file archive suffix
@cindex @file{ZIP} file archive suffix
@cindex file archive suffix @file{zip}
@cindex file archive suffix @file{ZIP}
@end itemize

@vindex tramp-archive-compression-suffixes
File archives could also be compressed, identified by an additional
compression suffix.  Valid compression suffixes are listed in the
constant @code{tramp-archive-compression-suffixes}.  They are
@samp{.bz2}, @samp{.gz}, @samp{.lrz}, @samp{.lz}, @samp{.lz4},
@samp{.lzma}, @samp{.lzo}, @samp{.uu}, @samp{.xz}, @samp{.Z}, and
@samp{.zst}.  A valid archive file name would be
@file{/path/to/dir/file.tar.gz/dir/file}.  Even several suffixes in a
row are possible, like @file{/path/to/dir/file.tar.gz.uu/dir/file}.

@vindex tramp-archive-all-gvfs-methods
An archive file name could be a remote file name, as in
@file{/ftp:anonymous@@ftp.gnu.org:/gnu/tramp/tramp-2.4.5.tar.gz/INSTALL}.
Since all file operations are mapped internally to @acronym{GVFS}
operations, remote file names supported by @code{tramp-gvfs} perform
better, because no local copy of the file archive must be downloaded
first.  For example, @samp{/sftp:user@@host:...} performs better than
the similar @samp{/scp:user@@host:...}.  See the constant
@code{tramp-archive-all-gvfs-methods} for a complete list of
@code{tramp-gvfs} supported method names.

If @code{url-handler-mode} is enabled, archives could be visited via
URLs, like
@file{https://ftp.gnu.org/gnu/tramp/tramp-2.4.5.tar.gz/INSTALL}.  This
allows complex file operations like

@lisp
@group
(progn
  (url-handler-mode 1)
  (ediff-directories
   "https://ftp.gnu.org/gnu/tramp/tramp-2.4.4.tar.gz/tramp-2.4.4"
   "https://ftp.gnu.org/gnu/tramp/tramp-2.4.5.tar.gz/tramp-2.4.5" ""))
@end group
@end lisp

It is even possible to access file archives in file archives, as

@lisp
@group
(progn
  (url-handler-mode 1)
  (find-file
   "http://ftp.debian.org/debian/pool/main/c/coreutils/coreutils_8.28-1_amd64.deb/control.tar.gz/control"))
@end group
@end lisp

@vindex tramp-archive-enabled
In order to disable file archives, you could add the following form to
your init file:

@lisp
(customize-set-variable 'tramp-archive-enabled nil)
@end lisp


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

@value{tramp}'s development team is actively engaged in solving bugs
and problems and looks to feature requests and suggestions.

@value{tramp}'s mailing list is the place for more advice and
information on working with @value{tramp}, solving problems,
discussing, and general discussions about @value{tramp}.

@value{tramp}'s mailing list is moderated but even non-subscribers can
post for moderator approval.  Sometimes this approval step may take as
long as 48 hours due to public holidays.

@email{@value{tramp-bug-report-address}} is the mailing list.
Messages sent to this address go to all the subscribers.  This is
@emph{not} the address to send subscription requests to.

To subscribe to the mailing list, visit:
@uref{https://lists.gnu.org/mailman/listinfo/tramp-devel/, the
@value{tramp} Mail Subscription Page}.

@ifset installchapter
Before sending a bug report, run the test suite first @ref{Testing}.
@end ifset

@findex tramp-bug
Check if the bug or problem is already addressed in @xref{Frequently
Asked Questions}.

Run @kbd{M-x tramp-bug @key{RET}} to generate a buffer with details of
the system along with the details of the @value{tramp} installation.
Please include these details with the bug report.

The bug report must describe in as excruciating detail as possible the
steps required to reproduce the problem.  These details must include
the setup of the remote host and any special or unique conditions that
exist.

Include a minimal test case that reproduces the problem.  This will
help the development team find the best solution and avoid unrelated
detours.

To exclude cache-related problems, flush all caches before running the
test, @ref{Cleanup remote connections}.  Alternatively, and often
better for analysis, reproduce the problem in a clean Emacs session
started with @command{emacs -Q}.  Then, @value{tramp} does not load
the persistency file (@pxref{Connection caching}), and it does not use
passwords from @file{auth-source.el} (@pxref{Password handling}).

When including @value{tramp}'s messages in the bug report, increase
the verbosity level to 6 (@pxref{Traces and Profiles, Traces}) in the
@file{~/.emacs} file before repeating steps to the bug.  Include the
contents of the @file{*tramp/foo*} and @file{*debug tramp/foo*}
buffers with the bug report.  Both buffers could contain
non-@acronym{ASCII} characters which are relevant for analysis, append
the buffers as attachments to the bug report.  This is also needed in
order to avoid line breaks during mail transfer.

@strong{Note} that a verbosity level greater than 6 is not necessary
at this stage.  Also note that a verbosity level of 6 or greater, the
contents of files and directories will be included in the debug
buffer.  Passwords typed in @value{tramp} will never be included
there.


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

@itemize @bullet
@item
Where is the latest @value{tramp}?

@value{tramp} is available at the GNU URL:

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

@noindent
@value{tramp}'s GNU project page is located here:

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


@item
Which systems does it work on?

The package works successfully on @w{Emacs 25}, @w{Emacs 26}, @w{Emacs
27}, and @w{Emacs 28}.

While Unix and Unix-like systems are the primary remote targets,
@value{tramp} has equal success connecting to other platforms, such as
MS Windows 7/8/10.


@item
How to speed up @value{tramp}?

@value{tramp} does many things in the background, some of which
depends on network speeds, response speeds of remote hosts, and
authentication delays.  During these operations, @value{tramp}'s
responsiveness slows down.  Some suggestions within the scope of
@value{tramp}'s settings include:

Use an external method, such as @option{scp}, which are faster than
internal methods.

Keep the file @code{tramp-persistency-file-name}, which is where
@value{tramp} caches remote information about hosts and files.  Caching
is enabled by default.  Don't disable it.

@vindex remote-file-name-inhibit-cache
Set @code{remote-file-name-inhibit-cache} to @code{nil} if remote
files are not independently updated outside @value{tramp}'s control.
That cache cleanup will be necessary if the remote directories or
files are updated independent of @value{tramp}.

Disable version control to avoid delays:

@lisp
@group
(setq vc-ignore-dir-regexp
      (format "\\(%s\\)\\|\\(%s\\)"
              vc-ignore-dir-regexp
              tramp-file-name-regexp))
@end group
@end lisp

If this is too radical, because you want to use version control
remotely, trim @code{vc-handled-backends} to just those you care
about, for example:

@lisp
(setq vc-handled-backends '(SVN Git))
@end lisp

Disable excessive traces.  Set @code{tramp-verbose} to 3 or lower,
default being 3.  Increase trace levels temporarily when hunting for
bugs.

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

Three main reasons for why @value{tramp} does not connect to the remote host:

@itemize @minus
@item
Unknown characters in the prompt

@value{tramp} needs a clean recognizable prompt on the remote host for
accurate parsing.  Shell prompts that contain escape sequences for
coloring cause parsing problems.  @ref{Remote shell setup} for
customizing prompt detection using regular expressions.

To check if the remote host's prompt is being recognized, use this
test: switch to @value{tramp} connection buffer @file{*tramp/foo*},
put the cursor at the top of the buffer, and then apply the following
expression:

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

If the cursor has not moved to the prompt at the bottom of the buffer,
then @value{tramp} has failed to recognize the prompt.

When using zsh on remote hosts, disable zsh line editor because zsh
uses left-hand side and right-hand side prompts in parallel.  Add the
following line to @file{~/.zshrc}:

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

This uses the default value of @code{tramp-terminal-type}, @t{"dumb"},
as value of the @env{TERM} environment variable.  If you want to use
another value for @env{TERM}, change @code{tramp-terminal-type} and
this line accordingly.

Alternatively, you could set the remote login shell explicitly.  See
@ref{Remote shell setup} for discussion of this technique,

When using fish shell on remote hosts, disable fancy formatting by
adding the following to @file{~/.config/fish/config.fish}:

@example
@group
function fish_prompt
  if test $TERM = "dumb"
     echo "\$ "
  else
     @dots{}
  end
end
@end group
@end example

When using WinSSHD on remote hosts, @value{tramp} does not recognize
the strange prompt settings.

A similar problem exist with the iTerm2 shell integration, which sends
proprietary escape codes when starting a shell.  This can be
suppressed by changing the respective integration snippet in your
@file{~/.profile} like this:

@example
@group
[ $TERM = "dumb" ] || \
test -e "$@{HOME@}/.iterm2_shell_integration.bash" && \
source "$@{HOME@}/.iterm2_shell_integration.bash"
@end group
@end example

And finally, bash's readline should not use key bindings like
@samp{C-j} to commands.  Disable this in your @file{~/.inputrc}:

@example
@group
$if term=dumb
# Don't bind Control-J or it messes up @value{tramp}.
$else
"\C-j": next-history
$endif
@end group
@end example

@item
Echoed characters after login

@value{tramp} suppresses echos from remote hosts with the
@command{stty -echo} command.  But sometimes it is too late to suppress
welcome messages from the remote host containing harmful control
characters.  Using @option{sshx} or @option{scpx} methods can avoid
this problem because they allocate a pseudo tty.  @xref{Inline
methods}.

@item
@value{tramp} stops transferring strings longer than 500 characters

Set @code{tramp-chunksize} to 500 to get around this problem, which is
related to faulty implementation of @code{process-send-string} on
HP-UX, FreeBSD and Tru64 Unix systems.  Consult the documentation for
@code{tramp-chunksize} to see when this is necessary.

Set @code{file-precious-flag} to @code{t} for files accessed by
@value{tramp} so the file contents are checked using checksum by
first saving to a temporary file.
@ifinfo
@pxref{Saving Buffers, , , elisp}.
@end ifinfo

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


@item
@value{tramp} fails in a chrooted environment

@vindex tramp-local-host-regexp
When connecting to a local host, @value{tramp} uses some internal
optimizations.  They fail when Emacs runs in a chrooted environment.
In order to disable those optimizations, set user option
@code{tramp-local-host-regexp} to @code{nil}.


@item
@value{tramp} does not recognize if a @command{ssh} session hangs

@command{ssh} sessions on the local host hang when the network is
down.  @value{tramp} cannot safely detect such hangs.  The network
configuration for @command{ssh} can be configured to kill such hangs
with the following command in the @file{~/.ssh/config}:

@example
@group
Host *
     ServerAliveInterval 5
@end group
@end example


@item
@value{tramp} does not use default @command{ssh} @option{ControlPath}

@value{tramp} overwrites @option{ControlPath} settings when initiating
@command{ssh} sessions.  @value{tramp} does this to fend off a stall
if a master session opened outside the Emacs session is no longer
open.  That is why @value{tramp} prompts for the password again even
if there is an @command{ssh} already open.

@vindex tramp-ssh-controlmaster-options
Some @command{ssh} versions support a @option{ControlPersist} option,
which allows you to set the @option{ControlPath} provided the variable
@code{tramp-ssh-controlmaster-options} is customized as follows:

@lisp
@group
(customize-set-variable
 'tramp-ssh-controlmaster-options
 (concat
   "-o ControlPath=/tmp/ssh-ControlPath-%%r@@%%h:%%p "
   "-o ControlMaster=auto -o ControlPersist=yes"))
@end group
@end lisp

Note how "%r", "%h" and "%p" must be encoded as "%%r", "%%h" and
"%%p".

@vindex tramp-use-ssh-controlmaster-options
If the @file{~/.ssh/config} is configured appropriately for the above
behavior, then any changes to @command{ssh} can be suppressed with
this @code{nil} setting:

@lisp
(customize-set-variable 'tramp-use-ssh-controlmaster-options nil)
@end lisp

This shall also be set to @code{nil} if you use the
@option{ProxyCommand} or @option{ProxyJump} options in your
@command{ssh} configuration.


@item
On multi-hop connections, @value{tramp} does not use @command{ssh}
@option{ControlMaster}

In order to use the @option{ControlMaster} option, @value{tramp} must
check whether the @command{ssh} client supports this option.  This is
only possible on the local host, for the first hop.  @value{tramp}
does not use this option on proxy hosts.

If you want to use this option also for the other hops, you must
configure @file{~/.ssh/config} on the proxy host:

@example
@group
Host *
     ControlMaster      auto
     ControlPath        tramp.%C
     ControlPersist     no
@end group
@end example

Check the @samp{ssh_config(5)} man page whether these options are
supported on your proxy host.


@item
@value{tramp} does not connect to Samba or MS Windows hosts running
SMB1 connection protocol

@vindex tramp-smb-options
Recent versions of @command{smbclient} do not support old connection
protocols by default.  In order to connect to such a host, add a
respective option:

@lisp
(add-to-list 'tramp-smb-options "client min protocol=NT1")
@end lisp

@strong{Note} that using a deprecated connection protocol raises
security problems, you should do it only if absolutely necessary.


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

@acronym{ANSI} escape sequences from the remote shell may cause errors
in @value{tramp}'s parsing of remote buffers.

To test if this is the case, open a remote shell and check if the output
of @command{ls} is in color.

To disable @acronym{ANSI} escape sequences from the remote hosts,
disable @samp{--color=yes} or @samp{--color=auto} in the remote host's
@file{.bashrc} or @file{.profile}.  Turn this alias on and off to see
if file name completion works.

@item
File name completion does not work in directories with large number of
files

This may be related to globbing, which is the use of shell's ability
to expand wild card specifications, such as @samp{*.c}.  For
directories with large number of files, globbing might exceed the
shell's limit on length of command lines and hang.  @value{tramp} uses
globbing.

To test if globbing hangs, open a shell on the remote host and then
run @command{ls -d * ..?* > /dev/null}.

When testing, ensure the remote shell is the same shell
(@command{/bin/sh}, @command{ksh} or @command{bash}), that
@value{tramp} uses when connecting to that host.


@item
How to get notified after @value{tramp} completes file transfers?

Make Emacs beep after reading from or writing to the remote host with
the following code in @file{~/.emacs}.

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

@group
(defadvice tramp-handle-do-copy-or-rename-file
  (after tramp-copy-beep-advice activate)
  "Make @value{tramp} beep after copying a file."
  (interactive)
  (beep))
@end group

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


@item
How to get a Visual Warning when working with @samp{root} privileges?
Host indication in the mode line?

@cindex @value{tramp} theme
@vindex tramp-theme-face-remapping-alist
Install @file{tramp-theme} from GNU ELPA via Emacs's Package Manager.
Enable it via @kbd{M-x load-theme @key{RET} tramp @key{RET}}.  Further
customization is explained in user option
@code{tramp-theme-face-remapping-alist}.


@item
Remote host does not understand default options for directory listing

Emacs computes the @command{dired} options based on the local host but
if the remote host cannot understand the same @command{ls} command,
then set them with a hook as follows:

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


@item
Why is @file{~/.sh_history} on the remote host growing?

@vindex tramp-histfile-override
@vindex HISTFILE@r{, environment variable}
@vindex HISTFILESIZE@r{, environment variable}
@vindex HISTSIZE@r{, environment variable}
Due to the remote shell saving tilde expansions triggered by
@value{tramp}, the history file is probably growing rapidly.
@value{tramp} can suppress this behavior with the user option
@code{tramp-histfile-override}.  When set to @code{t}, environment
variable @env{HISTFILE} is unset, and environment variables
@env{HISTFILESIZE} and @env{HISTSIZE} are set to 0.  Don't use this
with @command{bash} 5.0.0.  There is a bug in @command{bash} which
lets @command{bash} die.

Alternatively, @code{tramp-histfile-override} could be a string.
Environment variable @env{HISTFILE} is set to this file name then.  Be
careful when setting to @file{/dev/null}; this might result in
undesired results when using @command{bash} as remote shell.

Another approach is to disable @value{tramp}'s handling of the
@env{HISTFILE} at all by setting @code{tramp-histfile-override} to
@code{nil}.  In this case, saving history could be turned off by
putting this shell code in @file{.bashrc} or @file{.kshrc}:

@example
@group
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 group
@end example

For @option{ssh}-based method, add the following line to your
@file{~/.ssh/environment}:

@example
HISTFILE=/dev/null
@end example


@item
Where are remote files trashed to?

Emacs can trash file instead of deleting them, @ref{Misc File Ops,
Trashing , , emacs}.  Remote files are always trashed to the local
trash, except remote encrypted files (@pxref{Keeping files
encrypted}), which are deleted anyway.

If Emacs is configured to use the XDG conventions for the trash
directory, remote files cannot be restored with the respective tools,
because those conventions don't specify remote paths.  Such files must
be restored by moving them manually from
@file{$@{XDG_DATA_HOME@}/Trash/files/}, if needed.


@item
How to shorten long file names when typing in @value{tramp}?

Adapt several of these approaches to reduce typing.  If the full name
is @file{@trampfn{ssh,news@@news.my.domain,/opt/news/etc}}, then:

@enumerate

@item
Use simplified syntax:

If you always apply the default method (@pxref{Default Method}), you
could use the simplified @value{tramp} syntax (@pxref{Change file name
syntax}):

@lisp
@group
(customize-set-variable 'tramp-default-method "ssh")
(tramp-change-syntax 'simplified)
@end group
@end lisp

The reduced typing: @kbd{C-x C-f
@code{@value{prefix}news@@news.my.domain@value{postfix}/opt/news/etc}
@key{RET}}.

@item
Use default values for method name and user name:

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

@lisp
@group
(custom-set-variables
 '(tramp-default-method "ssh")
 '(tramp-default-user "news"))
@end group
@end lisp

The reduced typing: @kbd{C-x C-f
@trampfn{-,news.my.domain,/opt/news/etc} @key{RET}}.

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

@item
Use configuration options of the access method:

Programs used for access methods already offer powerful configurations
(@pxref{Customizing Completion}).  For @option{ssh}, configure the
file @file{~/.ssh/config}:

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

The reduced typing: @kbd{C-x C-f @trampfn{ssh,xy,/opt/news/etc} @key{RET}}.

Depending on the number of files in the directories, host names
completion can further reduce key strokes: @kbd{C-x C-f
@value{prefix}ssh@value{postfixhop}x @key{TAB}}.

@item
Use environment variables to expand long strings:

For long file names, set up environment variables that are expanded in
the minibuffer.  Environment variables are set either outside Emacs or
inside Emacs with Lisp:

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

The reduced typing: @kbd{C-x C-f $xy @key{RET}}.

@strong{Note} that file name cannot be edited here because the
environment variables are not expanded during editing in the
minibuffer.

@item Define own keys:

Redefine another key sequence in Emacs for @kbd{C-x C-f}:

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

Simply typing @kbd{C-x C-y} would prepare minibuffer editing of file
name.

See @uref{https://www.emacswiki.org/emacs/TrampMode, the Emacs Wiki}
for a more comprehensive example.

@item
Define own abbreviation (1):

Abbreviation list expansion can be used to reduce typing long file names:

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

The reduced typing: @kbd{C-x C-f /xy @key{RET}}.

@strong{Note} that file name cannot be edited here because the
abbreviations are not expanded during editing in the minibuffer.
Furthermore, the abbreviation is not expanded during @key{TAB}
completion.

@item
Define own abbreviation (2):

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

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

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

@group
(defadvice minibuffer-complete
  (before my-minibuffer-complete activate)
  (expand-abbrev))
@end group

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

The reduced typing: @kbd{C-x C-f xy @key{TAB}}.

The minibuffer expands for further editing.

@item Use bookmarks:

Use bookmarks to save @value{tramp} file names.
@ifinfo
@pxref{Bookmarks, , , emacs}.
@end ifinfo

Upon visiting a location with @value{tramp}, save it as a bookmark with
@kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{set}}.

To revisit that bookmark:
@kbd{@key{menu-bar} @key{edit} @key{bookmarks} @key{jump}}.

@item Use recent files:

@file{recentf} remembers visited places.
@ifinfo
@pxref{File Conveniences, , , emacs}.
@end ifinfo

Keep remote file names in the recent list without have to check for
their accessibility through remote access:

@lisp
(recentf-mode 1)
@end lisp

Reaching recently opened files: @kbd{@key{menu-bar} @key{file}
@key{Open Recent}}.

@item Use filecache:

Since @file{filecache} remembers visited places, add the remote
directory to the cache:

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

Then use directory completion in the minibuffer with @kbd{C-x C-f
C-@key{TAB}}.

@item Use bbdb:

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

Load @file{bbdb} in Emacs:

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

Create a BBDB entry with @kbd{M-x bbdb-create-ftp-site @key{RET}}.
Then specify a method and user name where needed.  Examples:

@example
@group
@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 group
@end example

In BBDB buffer, access an entry by pressing the key @kbd{F}.

@end enumerate

Thanks to @value{tramp} users for contributing to these recipes.

@item
Why saved multi-hop file names do not work in a new Emacs session?

When saving ad-hoc multi-hop @value{tramp} file names (@pxref{Ad-hoc
multi-hops}) via bookmarks, recent files, filecache, bbdb, or another
package, use the full ad-hoc file name including all hops, like
@file{@trampfn{ssh,bird@@bastion|ssh@value{postfixhop}news.my.domain,/opt/news/etc}}.

Alternatively, when saving abbreviated multi-hop file names
@file{@trampfn{ssh,news@@news.my.domain,/opt/news/etc}}, the user
option @code{tramp-save-ad-hoc-proxies} must be set non-@code{nil}
value.


@item
How to connect to a remote Emacs session using @value{tramp}?

Configure Emacs Client
@ifinfo
(@pxref{Emacs Server, , , emacs}).
@end ifinfo

Then on the remote host, start the Emacs Server:

@lisp
@group
(require 'server)
(setq server-host (system-name)
      server-use-tcp t)
(server-start)
@end group
@end lisp

If @code{(system-name)} of the remote host cannot be resolved on the
local host, use IP address instead.

Copy from the remote host the resulting file
@file{~/.emacs.d/server/server} to the local host, to the same
location.

Then start Emacs Client from the command line:

@example
emacsclient @trampfn{ssh,user@@host,/file/to/edit}
@end example

@code{user} and @code{host} refer to the local host.

To make Emacs Client an editor for other programs, use a wrapper
script @file{emacsclient.sh}:

@example
@group
#!/bin/sh
emacsclient @trampfn{ssh,$(whoami)@@$(hostname --fqdn),$1}
@end group
@end example

@vindex EDITOR@r{, environment variable}
Then change the environment variable @env{EDITOR} to point to the
wrapper script:

@example
export EDITOR=/path/to/emacsclient.sh
@end example


@item
How to determine whether a buffer is remote?

The buffer-local variable @code{default-directory} tells this.  If the
form @code{(file-remote-p default-directory)} returns non-@code{nil},
the buffer is remote.  See the optional arguments of
@code{file-remote-p} for determining details of the remote connection.


@item
How to save files when a remote host isn't reachable anymore?

If the local machine Emacs is running on changes its network
integration, remote hosts could become unreachable.  This happens for
example, if the local machine is moved between your office and your
home without restarting Emacs.

In such cases, the command @code{tramp-rename-files} can be used to
alter remote buffers’ method, host, and/or directory names.  This
permits saving their contents in the same location via another network
path, or somewhere else entirely (including locally).  @pxref{Renaming
remote files}.


@item
I get a warning @samp{Tramp has been compiled with Emacs a.b, this is Emacs c.d}

@value{tramp} comes with compatibility code for different Emacs
versions.  When you see this warning, you don't use the Emacs built-in
version of @value{tramp}.  In case you have installed @value{tramp}
from GNU ELPA, you must delete and reinstall it.
@ifset installchapter
In case you have installed it from its Git repository, @ref{Recompilation}.
@end ifset


@item
I get an error @samp{Remote file error: Forbidden reentrant call of Tramp}

@vindex remote-file-error
@vindex debug-ignored-errors
Timers, process filters and sentinels, and other event based functions
can run at any time, when a remote file operation is still running.
This can cause @value{tramp} to block.  When such a situation is
detected, this error is triggered.  It shall be fixed in the
respective function (an error report will help), but for the time
being you can suppress this error by the following code in your
@file{~/.emacs}:

@lisp
@group
(setq debug-ignored-errors
      (cons 'remote-file-error debug-ignored-errors))
@end group
@end lisp


@item
How to disable other packages from calling @value{tramp}?

There are packages that call @value{tramp} without the user ever
entering a remote file name.  Even without applying a remote file
syntax, some packages enable @value{tramp} on their own.  How can users
disable such features.

@itemize @minus
@item
@file{ido.el}

Disable @value{tramp} file name completion:

@lisp
(customize-set-variable 'ido-enable-tramp-completion nil)
@end lisp

@item
@file{rlogin.el}

Disable remote directory tracking mode:

@lisp
(rlogin-directory-tracking-mode -1)
@end lisp
@end itemize


@item
How to disable @value{tramp}?

@itemize @minus
@item
To keep Ange FTP as default the remote files access package, set this
in @file{.emacs}:

@lisp
(customize-set-variable 'tramp-default-method "ftp")
@end lisp

If you want to enable Ange FTP's syntax, add the following form:

@lisp
(tramp-change-syntax 'simplified)
@end lisp

@item
@vindex tramp-mode
To disable both @value{tramp} (and Ange FTP), set @code{tramp-mode} to
@code{nil} in @file{.emacs}.  @strong{Note}, that we don't use
@code{customize-set-variable}, in order to avoid loading @value{tramp}.

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

@item
@vindex tramp-ignored-file-name-regexp
To deactivate @value{tramp} for some look-alike remote file names, set
@code{tramp-ignored-file-name-regexp} to a proper regexp in
@file{.emacs}.  @strong{Note}, that we don't use
@code{customize-set-variable}, in order to avoid loading
@value{tramp}.

@lisp
(setq tramp-ignored-file-name-regexp "\\`/ssh:example\\.com:")
@end lisp

This is needed, if you mount for example a virtual file system on your
local host's root directory as @file{/ssh:example.com:}.

@item
To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp @key{RET}}.
Unloading @value{tramp} resets Ange FTP plugins also.
@end itemize
@end itemize


@c For the developer
@node Files directories and localnames
@chapter How file names, directories and localnames are mangled and managed

@menu
* Localname deconstruction::    Splitting a localname into its component parts.
* External packages::           Integrating with external Lisp packages.
@end menu


@node Localname deconstruction
@section Splitting a localname into its component parts

@value{tramp} package redefines lisp functions
@code{file-name-directory} and @code{file-name-nondirectory} to
accommodate the unique file naming syntax that @value{tramp} requires.

The replacements dissect the file name, use the original handler for
the localname, take that result, and then re-build the @value{tramp}
file name.  By relying on the original handlers for localnames,
@value{tramp} benefits from platform specific hacks to the original
handlers.


@node External packages
@section Integrating with external Lisp packages
@subsection File name completion

@vindex non-essential
Sometimes, it is not convenient to open a new connection to a remote
host, including entering the password and alike.  For example, this is
nasty for packages providing file name completion.  Such a package
could signal to @value{tramp}, that they don't want it to establish a
new connection.  Use the variable @code{non-essential} temporarily and
bind it to non-@code{nil} value.

@lisp
@group
(let ((non-essential t))
  @dots{})
@end group
@end lisp


@subsection File attributes cache

@vindex process-file-side-effects
Keeping a local cache of remote file attributes in sync with the
remote host is a time-consuming operation.  Flushing and re-querying
these attributes can tax @value{tramp} to a grinding halt on busy
remote servers.

To get around these types of slow-downs in @value{tramp}'s
responsiveness, set the @code{process-file-side-effects} to @code{nil}
to stop @value{tramp} from flushing the cache.  This is helpful in
situations where callers to @code{process-file} know there are no file
attribute changes.  The let-bind form to accomplish this:

@lisp
@group
(let (process-file-side-effects)
  @dots{})
@end group
@end lisp

For asynchronous processes, @value{tramp} uses a process sentinel to
flush file attributes cache.  When callers to @code{start-file-process}
know beforehand no file attribute changes are expected, then the
process sentinel should be set to the default state.  In cases where
the caller defines its own process sentinel, @value{tramp}'s process
sentinel is overwritten.  The caller can still flush the file
attributes cache in its process sentinel with this code:

@lisp
@group
(unless (memq (process-status proc) '(run open))
  (dired-uncache remote-directory))
@end group
@end lisp

Since @value{tramp} traverses subdirectories starting with the
root-directory, it is most likely sufficient to make the
@code{default-directory} of the process buffer as the root directory.


@subsection Timers

@vindex remote-file-error
Timers run asynchronously at any time when Emacs is waiting for
sending a string to a process, or waiting for process output.  They
can run any remote file operation, which would conflict with the
already running remote file operation, if the same connection is
affected.  @value{tramp} detects this situation, and raises the
@code{remote-file-error} error.  A timer function shall avoid this
situation.  At least, it shall protect itself against this error, by
wrapping the timer function body with

@lisp
@group
(ignore-error 'remote-file-error
  @dots{})
@end group
@end lisp


@node Traces and Profiles
@chapter How to Customize Traces
@vindex tramp-verbose
@vindex tramp-debug-to-file

@value{tramp} messages are raised with verbosity levels ranging from 0
to 10.  @value{tramp} does not display all messages; only those with a
verbosity level less than or equal to @code{tramp-verbose}.

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{ 9}  test commands
@*@indent @w{10}  traces (huge)

With @code{tramp-verbose} greater than or equal to 4, messages are
also written to a @value{tramp} debug buffer.  Such debug buffers are
essential to bug and problem analyses.  For @value{tramp} bug reports,
set the @code{tramp-verbose} level to 6 (@pxref{Bug Reports}).

The debug buffer is in
@ifinfo
@ref{Outline Mode, , , emacs}.
@end ifinfo
@ifnotinfo
Outline Mode.
@end ifnotinfo
In this buffer, messages can be filtered by their level.  To see
messages up to verbosity level 5, enter @kbd{C-u 6 C-c C-q}.
@ifinfo
Other navigation keys are described in
@ref{Outline Visibility, , , emacs}.
@end ifinfo

@value{tramp} handles errors internally.  But to get a Lisp backtrace,
both the error and the signal have to be set as follows:

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

If @code{tramp-verbose} is greater than or equal to 10, Lisp
backtraces are also added to the @value{tramp} debug buffer in case of
errors.

In very rare cases it could happen, that @value{tramp} blocks Emacs.
Killing Emacs does not allow to inspect the debug buffer.  In that
case, you might instruct @value{tramp} to mirror the debug buffer to
file:

@lisp
(customize-set-variable 'tramp-debug-to-file t)
@end lisp

The debug buffer is written as file in your
@code{temporary-file-directory}, which is usually @file{/tmp/}.  Use
this option with care, because it could decrease the performance of
@value{tramp} actions.

To enable stepping through @value{tramp} function call traces, they
have to be specifically enabled as shown in this code:

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

The buffer @file{*trace-output*} contains the output from the function
call traces.  Disable @code{tramp-read-passwd} to stop password
strings from being written to @file{*trace-output*}.


@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

@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 * Consistent small or capitalized words especially in menus.