This file is indexed.

/usr/share/doc/lsh-doc/lsh.html is in lsh-doc 2.0.4-dfsg-11.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
<html lang="en">
<head>
<title>lsh</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="description" content="lsh">
<meta name="generator" content="makeinfo 4.6">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
--></style>
</head>
<body>
<h1 class="settitle">lsh</h1>

<div class="contents">
<h2>Table of Contents</h2>
<ul>
<li><a name="toc_Introduction" href="#Introduction">Introduction</a>
<ul>
<li><a href="#Threats">Threats</a>
<li><a href="#Features">Features</a>
<li><a href="#Related%20techniques">Related programs and techniques</a>
<ul>
<li><a href="#ssh1"><code>ssh-1.x</code></a>
<li><a href="#ssh2"><code>ssh-2.x</code></a>
<li><a href="#Kerberos">Kerberos</a>
<li><a href="#ipsec"><small>IPSEC</small></a>
</li></ul>
</li></ul>
<li><a name="toc_Installation" href="#Installation">Installation</a>
<li><a name="toc_Getting%20started" href="#Getting%20started">Getting started</a>
<ul>
<li><a href="#lsh-make-seed">Initializing the randomness generator</a>
<li><a href="#lsh%20basics"><code>lsh</code> basics</a>
<li><a href="#tcpip%20forwarding">Port forwarding</a>
<li><a href="#lshd%20basics"><code>lshd</code> basics</a>
<li><a href="#public-key">Using public-key user authentication</a>
<li><a href="#srp">Using <small>SRP</small> authentication</a>
<li><a href="#sexp">Examining keys and other sexp files</a>
<li><a href="#Converting%20keys">Converting keys from <code>ssh2</code> and OpenSSH</a>
</li></ul>
<li><a name="toc_Invoking%20lsh" href="#Invoking%20lsh">Invoking <code>lsh</code></a>
<ul>
<li><a href="#Algorithm%20options">Algorithm options</a>
<li><a href="#Hostauth%20options">Host authentication options</a>
<li><a href="#Userauth%20options">User authentication options</a>
<li><a href="#Action%20options">Action options</a>
<li><a href="#Verbosity%20options">Verbosity options</a>
</li></ul>
<li><a name="toc_Invoking%20lshg" href="#Invoking%20lshg">Invoking <code>lshg</code></a>
<li><a name="toc_Invoking%20lshd" href="#Invoking%20lshd">Invoking <code>lshd</code></a>
<li><a name="toc_Files%20and%20environment%20variables" href="#Files%20and%20environment%20variables">Files and environment variables</a>
<li><a name="toc_Terminology" href="#Terminology">Terminology</a>
<li><a name="toc_Concept%20Index" href="#Concept%20Index">Concept Index</a>
</li></ul>
</div>


<div class="node">
<p><hr>
Node:&nbsp;<a name="Top">Top</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Introduction">Introduction</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<br>
</div>

   <p>This document describes <code>lsh</code> and related programs. The
<code>lsh</code> suite of programs is intended as a free replacement for
the <code>ssh</code> suite of programs. In turn, <code>ssh</code> was intended
as a secure replacement for the <code>rsh</code> and <code>rlogin</code>
programs for remote login over the Internet.

   <p><code>lsh</code> is a component of the <small>GNU</small> system.

   <p>This manual explains how to use and hack <code>lsh</code>; it corresponds to
<code>lsh</code> version 2.0.

<ul class="menu">
<li><a accesskey="1" href="#Introduction">Introduction</a>: 
<li><a accesskey="2" href="#Installation">Installation</a>: 
<li><a accesskey="3" href="#Getting%20started">Getting started</a>: 
<li><a accesskey="4" href="#Invoking%20lsh">Invoking lsh</a>: 
<li><a accesskey="5" href="#Invoking%20lshg">Invoking lshg</a>: 
<li><a accesskey="6" href="#Invoking%20lshd">Invoking lshd</a>: 
<li><a accesskey="7" href="#Files%20and%20environment%20variables">Files and environment variables</a>: 
<li><a accesskey="8" href="#Terminology">Terminology</a>: 
<li><a accesskey="9" href="#Concept%20Index">Concept Index</a>:

<p>--- The Detailed Node Listing ---

<p>Introduction

</p><li><a href="#Threats">Threats</a>: 
<li><a href="#Features">Features</a>: 
<li><a href="#Related%20techniques">Related techniques</a>:

<p>Related programs and techniques

</p><li><a href="#ssh1">ssh1</a>:                         SSH version 1
<li><a href="#ssh2">ssh2</a>:                         SSH version 2
<li><a href="#Kerberos">Kerberos</a>:                     Kerberos
<li><a href="#ipsec">ipsec</a>:                        IP Sec

<p>Getting started

</p><li><a href="#lsh-make-seed">lsh-make-seed</a>:                Initializing the randomness generator
<li><a href="#lsh%20basics">lsh basics</a>:                   Connection with lsh
<li><a href="#tcpip%20forwarding">tcpip forwarding</a>:             Forwarding <small>TCP/IP</small> ports
<li><a href="#lshd%20basics">lshd basics</a>:                  Starting the lshd deamon
<li><a href="#public-key">public-key</a>:                   Using public-keys
<li><a href="#srp">srp</a>:                          Using SRP authentication
<li><a href="#sexp">sexp</a>:                         Examining keys and other S-exp files
<li><a href="#Converting%20keys">Converting keys</a>:

<p>Invoking <code>lsh</code>

</p><li><a href="#Algorithm%20options">Algorithms</a>:   Selecting algorithms. 
<li><a href="#Hostauth%20options">Hostauth options</a>: 
<li><a href="#Userauth%20options">Userauth options</a>: 
<li><a href="#Action%20options">Actions</a>:       What to do after login. 
<li><a href="#Verbosity%20options">Messages</a>:   Tuning the amount of messages.

   </ul>

<div class="node">
<p><hr>
Node:&nbsp;<a name="Introduction">Introduction</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Installation">Installation</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Top">Top</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<h2 class="chapter">Introduction</h2>

<p>What is this thing called computer security anyway? Why would you want
to use a program like <code>lsh</code>?

   <p>This chapter explains the threats <code>lsh</code> tries to protect you from,
and some of the threats that remain. It also describes some of the
technologies used in <code>lsh</code>.

   <p>From time to time in this manual, I will speak about the <dfn>enemy</dfn>. 
This means anybody who is trying to eavesdrop or disturb your private
communication. This usage is technical, and it does not imply that the
enemy is somehow morally inferior to you: The enemy may be some awful
criminals trying to eavesdrop on you, or it may be the police trying to
eavesdrop on the same criminals.

   <p>The enemy can be a criminal, or a competitor, or your boss who's trying
to find out how much you tell collegues at competing firms. It may be
your own or somebody else's national security officials. Or your
ex-boyfriend who happens to be too curious.

   <p>So what can the enemy do to your communications and your privacy? 
Remember that just because you're paranoid that doesn't mean that nobody
is trying to get you<small class="dots">...</small>

<ul class="menu">
<li><a accesskey="1" href="#Threats">Threats</a>: 
<li><a accesskey="2" href="#Features">Features</a>: 
<li><a accesskey="3" href="#Related%20techniques">Related techniques</a>: 
</ul>

<div class="node">
<p><hr>
Node:&nbsp;<a name="Threats">Threats</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Features">Features</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Introduction">Introduction</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Introduction">Introduction</a>
<br>
</div>

<h3 class="section">Threats</h3>

<p>When logging in to some other machine via the Internet, either in the
same building or a few continents away, there are several things that
may be under enemy attack.

     <dl>
<dt><dfn>Local attacks</dfn>
     <dd>The enemy controls your local environment. He or she may be looking over
your shoulder. Your local machine might be cracked. Or there may be some
device planted inside your keyboard transmitting everything you type to
the attacker. About the same problems occur if the attacker has taken
control over your target machine, i.e. the remote machine you have
logged in to.

     <br><dt><dfn>Denial-of-service attacks</dfn>
     <dd>The enemy has cut your network cable, effectively stopping your
communication. Even without doing physical damage, the enemy may be able
to flood and overload computers or network equipment. Or disrupt network
traffic by sending fake packets to hangup your <small>TCP/IP</small>
connections.

     <br><dt><dfn>Passive eavesdropping</dfn>
     <dd>The enemy may be able to listen to your communication somewhere along
its path. With the global Internet, it's difficult to predict who might
be able to listen. Internet traffic between buildings just a few hundred
meters apart have been observed temporarily being routed through half a
dozen countries, perhaps a few thousand kilometers.

     <p>And even without routing anomalies, it is possible that the enemy has
been able to take control of some nearby machine, and can listen in from
there. Of course, passive eavesdropping is most dangerous if you
transmit cleartext passwords. This is the main reason not to use vanilla
telnet to login to remote systems. Use a telnet with support for
<small>SSL</small> or Kerberos, or use a program like <code>lsh</code> or
<code>ssh</code>.

     <p>A passive eavesdropper is assumed not to do anything nasty with your
packets beyond listening to them.

     <br><dt><dfn>Name resolution attacks</dfn>
     <dd>The translation from symbolic <small>DNS</small> names to numeric
ip-addresses may be controlled by the attacker. In this case, you may
think that you are connecting to a friendly machine, when in fact you
are connecting somewhere else.

     <br><dt><dfn>Fake packets</dfn>
     <dd>It is fairly easy to fake the source address of an <small>IP</small>-packet,
although it is more difficult to get hold on the replies to the faked
packets. But even without any replies, this can cause serious
problems.

     <br><dt><dfn>Man-in-the-middle attack</dfn>
     <dd>In this attack, the enemy sits between you and the target. When
communicating with you, he pretends to be the target. When communicating
with the target, he pretends to be you. He also passes all information
on more or less unmodified, so that he is invisible to you and the
target. To mount this attack, the enemy either needs physical access to
some network equipment on the path between you and the target, or he has
been able to fool you to connect to him rather than to the target, for
example by manipulating the <small>DNS</small>-system.

   </dl>

   <p><code>lsh</code> makes no attempt to protect you from local attacks. You have
to trust the endpoint machines. It seems really difficult to uphold any
security if the local machine is compromised. This is important to keep
in mind in the "visitor"-scenario, where you visit a friend or perhaps an
Internet café and want to connect to some of the machines at home or at
work. If the enemy has been able to compromize your friend's or the
café's equipment, you may well be in trouble.

   <p>Protection from denial-of-service attacks is also a very difficult
problem, and <code>lsh</code> makes no attempt to protect you from that.

   <p>Instead, the aim of <code>lsh</code>, and most serious tools for cryptographic
protection of communications across the net, is to isolate the
vulnerabilities to the communication endpoints. If you know that the
endpoints are safe, the enemy should not be able to compromize your
privacy or communications. Except for denial-of-service attacks (which
at least can't be performed without you noticing it).

   <p>First of all, <code>lsh</code> provides protection against passive
eavesdropping. In addition, if you take the appropriate steps to make
sure that hostkeys are properly authenticated, <code>lsh</code> also protects
against man-in-the-middle attacks and in particular against attacks on
the name resolution. In short, you need only trust the security at the
end points: Even if the enemy controls all other network equipment, name
resolution and routing infrastructure, etc, he can't do anything beyond
the denial-of-service attack.

   <p>And at last, remember that there is no such thing as absolute security. 
You have to estimate the value of that which you are protecting, and
adjust the security measures so that your enemies will not find it worth
the effort to break them.

<div class="node">
<p><hr>
Node:&nbsp;<a name="Features">Features</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Related%20techniques">Related techniques</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Threats">Threats</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Introduction">Introduction</a>
<br>
</div>

<h3 class="section">Features</h3>

<p><code>lsh</code> does not only provide more secure replacements for
<code>telnet</code>, <code>rsh</code> and <code>rlogin</code>, it also provides
some other features to make it convenient to communicate securely. This
section is expected to grow with time, as more features from the
wish-list are added to lsh. One goal for <code>lsh</code> is to make it
reasonable easy to extend it, without messing with the core security
functionality.

   <p><code>lsh</code> can also be used in something called gateway mode, in
which you can authenticate once and set up a connection that can
later be used for quickly setting up new sessions with <code>lshg</code>
(see <a href="#Invoking%20lshg">Invoking lshg</a>).

   <p><code>lsh</code> can be configured to allow login based on a personal
key-pair consisting of a private and a public key, so that you can
execute remote commands without typing your password every time. There
is also experimental support for Thomas Wu's Secure Remote Password
Protocol (<small>SRP</small>). Kerberos support is on the wish list but not
yet supported (see <a href="#Kerberos">Kerberos</a>).

   <p>The public-key authentication methods should also be extended to support
Simple Public Key Infrastructure (<small>SPKI</small>) certificates,
including some mechanism to delegate restricted logins.

   <p>Forwarding of arbitrary <small>TCP/IP</small> connections is provided. This
is useful for tunneling otherwise insecure protocols, like telnet and
pop, through an encrypted <code>lsh</code> connection.

   <p><code>lsh</code> also features a <small>SOCKS</small>-proxy which also
provides tunneling of <small>TCP/IP</small> connections, but can be easily
used, e.g.  from within popular web browsers like Mozilla and Firefox
for tunneling web traffic. There are also programs like
<code>tsocks</code> that performs transparent redirection of network
access through a <small>SOCKS</small> proxy.

   <p>Convenient tunneling of <small>X</small> was one of the most impressive
features of the original <code>ssh</code> programs. Both <code>lsh</code> and
<code>lshd</code> support <small>X</small>-forwarding, although <code>lshg</code>
does not.

   <p>Whan <small>X</small> forwarding is in effect, the remote process is started
in an environment where the <code>DISPLAY</code> variable in the environment
points to a fake <small>X</small> server, connections to which are forwarded
to the <small>X</small> server in your local environment. <code>lsh</code> also
creates a new "fake" <code>MIT-MAGIC-COOKIE-1</code> for controlling access
control. Your real <small>X</small> authentication data is never sent to the
remote machine.

   <p>Other kinds of tunneling that may turn out to be useful include
authentication (i.e. <code>ssh-agent</code>), general forwarding of
<small>UDP</small>, and why not also general <small>IP</small>-tunneling.

<div class="node">
<p><hr>
Node:&nbsp;<a name="Related%20techniques">Related techniques</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Features">Features</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Introduction">Introduction</a>
<br>
</div>

<h3 class="section">Related programs and techniques</h3>

<p>This sections describes some other programs and techniques related to
<code>lsh</code>. The ssh family of programs use mostly the same kind of
security as <code>lsh</code>. Kerberos and <small>IPSEC</small> operate quite
differently, in particular when it comes to protection against
man-in-the-middle attacks.

<ul class="menu">
<li><a accesskey="1" href="#ssh1">ssh1</a>:                         SSH version 1
<li><a accesskey="2" href="#ssh2">ssh2</a>:                         SSH version 2
<li><a accesskey="3" href="#Kerberos">Kerberos</a>:                     Kerberos
<li><a accesskey="4" href="#ipsec">ipsec</a>:                        IP Sec
</ul>

<div class="node">
<p><hr>
Node:&nbsp;<a name="ssh1">ssh1</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#ssh2">ssh2</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Related%20techniques">Related techniques</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Related%20techniques">Related techniques</a>
<br>
</div>

<h3 class="subsection"><code>ssh-1.x</code></h4>

<p>The first of the Secure shell programs was Tatu Ylönen's <code>ssh</code>. 
The latest of the version 1 series is <code>ssh-1.33</code> which speaks
version 1.5 of the protocol. The "free" version of <code>ssh-1.33</code>
does not allow commercial use without additional licensing, which makes
<code>ssh-1.33</code> non-free software according to Debian's Free Software
Guidelines and the Open Source Definition.

   <p>The version 1 protocol has some subtle weaknesses, in particular, all
support for using stream ciphers was disabled by default a few versions
back, for security reasons.

   <p>There also exists free implementations of <code>ssh-1</code>, for both Unix
and Windows. <code>ossh</code> and later OpenSSH are derived from earlier
version av Tatu Ylönen's <code>ssh</code>, and are free software.

<div class="node">
<p><hr>
Node:&nbsp;<a name="ssh2">ssh2</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Kerberos">Kerberos</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#ssh1">ssh1</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Related%20techniques">Related techniques</a>
<br>
</div>

<h3 class="subsection"><code>ssh-2.x</code></h4>

<p><code>ssh2</code> implements the next generation of the Secure Shell
protocol, the development of which is supervised by the <small>IETF</small>
secsh Working Group. Besides <code>lsh</code>, some well known
implementations of this protocol includes
     <ul>
<li>OpenSSH (which supports version 2 of the protocol since May 2000).

     <li>The <code>ssh2</code> series of proprietary programs sold by the SSH
company. <code>lsh</code> interoperates with current versions of these
programs, but not with version 3.0 and earlier (the older versions get
some details of the protocol wrong, probably because it predates the
protocol specification). The license for the SSH company's
<code>ssh2</code> programs is similar to that for recent versions of
<code>ssh1</code>, but with a narrower definition of "non-commercial
use".

     <li><code>putty</code>, a free <code>ssh</code> implementation for Microsoft
Windows.

   </ul>

   <p>There a numerous other implementations, both free and proprietary. The
above list is far from complete.

<div class="node">
<p><hr>
Node:&nbsp;<a name="Kerberos">Kerberos</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#ipsec">ipsec</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#ssh2">ssh2</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Related%20techniques">Related techniques</a>
<br>
</div>

<h3 class="subsection">Kerberos</h4>

<p>Kerberos is a key distribution system originally developed in the late
1980:s as a part of Project Athena at <small>MIT</small>. Recent development
have been done at The Royal Institute of Technology, Stockholm
(<small>KTH</small>).

   <p>Kerberos uses a central trusted ticket-granting server, and requires
less trust on the local machines in the system. It does not use
public-key technology.

   <p>Usually, Kerberos support is compiled into applications such as telnet,
ftp and X-clients. The ssh family of programs, on the other hand, tries
to do all needed magic, for instance to forward <small>X</small> securely,
and then provides general <small>TCP/IP</small> forwarding as a kitchen sink.

   <p>I believe Kerberos' and lsh's protection against passive eavesdropping
are mostly equivalent. The difference is in the set of machines and
assumptions you have to trust in order to be safe from a
man-in-the-middle attack.

   <p>I think the main advantage of <code>lsh</code> over Kerberos is that it is
easier to install and use for on ordinary mortal user. In order to set
up key exchange between two different Kerberos systems (or <dfn>Kerberos
realms</dfn>), the respective system operators need to exchange keys. In the
case of two random users at two random sites, setting up <code>lsh</code> or
some other program in the ssh family is likely easier than to get the
operators to spend time and attention. So <code>lsh</code> should be easier to
use in an anarchistic grass-roots environment.

   <p>Another perspective is to combine ssh features like <small>X</small> and
<small>TCP/IP</small> forwarding with authentication based on Kerberos. Such
an arrangement may provide the best of two worlds for those who happen
to have an account at a suitable ticket-granting server.

<div class="node">
<p><hr>
Node:&nbsp;<a name="ipsec">ipsec</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Kerberos">Kerberos</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Related%20techniques">Related techniques</a>
<br>
</div>

<h3 class="subsection"><small>IPSEC</small></h4>

<p><small>IPSEC</small> is a set of protocols for protecting general
<small>IP</small> traffic. It is developed by another <small>IETF</small> working
group, and is also a required part of <small>IP</small> version 6.

   <p>Again, the main difference between <small>IPSEC</small>, Kerberos and ssh
is the set of machines that have to be secure and the keys that have to
be exchanged in order to avoid man-in-the-middle attacks.

   <p>Current protocols and implementations of <small>IPSEC</small> only provide
authentication of machines; there's nothing analogous to the user
authentication in ssh or Kerberos.

   <p>On the other hand, <small>IPSEC</small> provides one distinct advantage over
application level encryption. Because <small>IP</small> and <small>TCP</small>
headers are authenticated, it provides protection against some
denial-of-service attacks. In particular, it makes attacks that cause
hangup of a <small>TCP</small> connection considerably more difficult.

   <p>So it makes sense to use both <small>IPSEC</small> and some application
level cryptographic protocol.

   <p>Also note that it is possible to use the <dfn>Point-to-Point Protocol</dfn>
(<small>PPP</small>) to tunnel arbitrary <small>IP</small> traffic accross an ssh
connection. This arrangement provides some of the functionality of
<small>IPSEC</small>, and is sometimes referred to as "a poor man's Virtual
Private Network".

<div class="node">
<p><hr>
Node:&nbsp;<a name="Installation">Installation</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Getting%20started">Getting started</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Introduction">Introduction</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<h2 class="chapter">Installation</h2>

<p>You install <code>lsh</code> with the usual <code>./configure &amp;&amp; make &amp;&amp;
make install</code>. For a full listing of the options you can give to
<code>configure</code>, use <code>./configure --help</code>. For example, use
<code>--without-pty</code> to disable pty-support.

   <p>The most commonly used option is <code>--prefix</code>, which tells
configure where lsh should be installed. Default prefix is
<code>/usr/local</code>. The <code>lshd</code> server is installed in
<code>$prefix/sbin</code>, all other programs and scripts are installed in
<code>$prefix/bin</code>.

   <p>The configure script tries to figure out if the linker needs any special
flags specifying where to find dynamically linked libraries at run time
(one case where this matters is if you have a dynamic libz.so installed
in a non-standard place). Usually, you can use

<pre class="example">     ./configure --with-lib-path=/opt/lib:/other/place
     </pre>

<p>to specify extra library directories, and the configure script should do
the right thing. If this doesn't work, or you believe that you know your
system better than <code>./configure</code>, just set LDFLAGS and/or
LD_LIBRARY_PATH to the right values instead.

<div class="node">
<p><hr>
Node:&nbsp;<a name="Getting%20started">Getting started</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Invoking%20lsh">Invoking lsh</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Installation">Installation</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<h2 class="chapter">Getting started</h2>

<p>This section tells you how to perform some common tasks using the
<code>lsh</code> suite of programs, without covering all options and
possibilities.

<ul class="menu">
<li><a accesskey="1" href="#lsh-make-seed">lsh-make-seed</a>:                Initializing the randomness generator
<li><a accesskey="2" href="#lsh%20basics">lsh basics</a>:                   Connection with lsh
<li><a accesskey="3" href="#tcpip%20forwarding">tcpip forwarding</a>:             Forwarding <small>TCP/IP</small> ports
<li><a accesskey="4" href="#lshd%20basics">lshd basics</a>:                  Starting the lshd deamon
<li><a accesskey="5" href="#public-key">public-key</a>:                   Using public-keys
<li><a accesskey="6" href="#srp">srp</a>:                          Using SRP authentication
<li><a accesskey="7" href="#sexp">sexp</a>:                         Examining keys and other S-exp files
<li><a accesskey="8" href="#Converting%20keys">Converting keys</a>: 
</ul>

<div class="node">
<p><hr>
Node:&nbsp;<a name="lsh-make-seed">lsh-make-seed</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#lsh%20basics">lsh basics</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Getting%20started">Getting started</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting%20started">Getting started</a>
<br>
</div>

<h3 class="section">Initializing the randomness generator</h3>

<p>Several of the lsh programs requires a good pseudorandomness generator
for secure operation. The first thing you need to do is to create a
seed file for the generator. To create a personal seed file, stored as
<code>~/.lsh/yarrow-seed-file</code>, run

<pre class="example">     lsh-make-seed
     </pre>

   <p>To create a seed file for use by <code>lshd</code>, run

<pre class="example">     lsh-make-seed --server
     </pre>

   <p>as root. The seed file is stored as
<code>/var/spool/lsh/yarrow-seed-file</code>.

<div class="node">
<p><hr>
Node:&nbsp;<a name="lsh%20basics">lsh basics</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#tcpip%20forwarding">tcpip forwarding</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#lsh-make-seed">lsh-make-seed</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting%20started">Getting started</a>
<br>
</div>

<h3 class="section"><code>lsh</code> basics</h3>

<p><code>lsh</code> is the program you use for connection to a remote machine. A
few examples are:

<pre class="example">     lsh sara.lysator.liu.se
     </pre>

<p>Connects to <code>sara.lysator.liu.se</code> and starts an interactive shell. 
In this example, and in the rest of the examples in this section, lsh
will ask for your password, unless you have public-key user
authentication set up.

   <p>The first time you try to connect to a new machine, <code>lsh</code>
typically complains about an "unknown host key". This is because it
has no reason to believe that it was the right machine that answered,
and not a machine controlled by the enemy (see <a href="#Threats">Threats</a>). The default
behaviour is to never ever accept a server that is not properly
authenticated. A machine is considered authentic if it follows the
protocol and has an acl-entry for its public hostkey listed in
<code>~/.lsh/host-acls</code>.

   <p>To make lsh less paranoid, use

<pre class="example">     lsh --sloppy-host-authentication sara.lysator.liu.se
     </pre>

<p>Then <code>lsh</code> will display a <dfn>fingerprint</dfn> of the host key of
the remote machine, and ask you if it is correct. If so, the machine is
considered authentic and a corresponding acl-entry is appended to the
file <code>~/.lsh/captured_keys</code>. You can copy acl-entries you have
verified to <code>~/.lsh/host-acls</code>.

   <p>You can even use

<pre class="example">     lsh --sloppy-host-authentication --capture-to ~/.lsh/host-acls
     </pre>

<p>to get <code>lsh</code> to behave more like the traditional <code>ssh</code>
program.

<pre class="example">     lsh -l omar sara.lysator.liu.se
     </pre>

<p>Connects, like above, but tries to log in as the user "omar".

<pre class="example">     lsh sara.lysator.liu.se tar cf - some/dir | (cd /target/dir &amp;&amp; tar -xf -)
     </pre>

   <p>Copies a directory from the remote machine, by executing one remote and
one local <code>tar</code> process and piping them together.

<pre class="example">     CVS_RSH=lsh cvs -d cvs.lysator.liu.se:/cvsroot/lsh co lsh
     </pre>

<p>Checks out the <code>lsh</code> source code from the <small>CVS</small>
repository.

<pre class="example">     lsh -G -B sara.lysator.liu.se
     </pre>

   <p>Opens an ssh connection, creates a "gateway socket", and forks into
the background.

<pre class="example">     lshg sara.lysator.liu.se
     </pre>

   <p>creates a new session using an existing gateway socket, without the
overhead for a new key exchange and without asking for any passwords.

<div class="node">
<p><hr>
Node:&nbsp;<a name="tcpip%20forwarding">tcpip forwarding</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#lshd%20basics">lshd basics</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#lsh%20basics">lsh basics</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting%20started">Getting started</a>
<br>
</div>

<h3 class="section">Port forwarding</h3>

<p>One useful feature of <code>lsh</code> and other ssh-like programs is the
ability to forward arbitrary connections inside the encrypted
connection. There are two flavors: "local" and "remote" forwarding.

   <p>An example of local forwarding is

<pre class="example">     lsh -L 4000:kom.lysator.liu.se:4894 sara.lysator.liu.se
     </pre>

<p>This makes <code>lsh</code> listen on port 4000 on the <em>local</em>
machine. When someone connects, <code>lsh</code> asks the server to open a
connection from the <em>remote</em> machine (i.e. <code>sara</code>) to port
4894 on another machine (i.e. <code>kom</code>). The two connections are piped
together using an encrypted channel.

   <p>There are a few things that should be noted here:

     <ul>
<li>By default, <code>lsh</code> only listens on the loopback interface, so only
clients on the same machine can use the tunnel. To listen on all
interfaces, use the <code>-g</code> flag.

     <li>A connection through the tunnel consists of three parts:

          <ol type=1 start=1>
<li>From a client socket to the local port (4000 in this example) that
<code>lsh</code> listens on.

          <li>The tunnel itself, from the local machine to the tunnel endpoint,
which is <code>sara</code> in this example.

          <li>The connection from the tunnel endpoint to the ultimate target, in this
example from <code>sara</code> to <code>kom</code>.

          </ol>

     <p>Only the middle part is protected by <code>lsh</code>: all data flowing
through the tunnel is sent across the first and last part <em>in the
clear</em>. So forwarding doesn't offer much protection unless the tunnel
endpoint and the ultimate target machine are close to each other. They
should usually be either the same machine, or two machines connected by
a local network that is trusted.

     </p><li>Port forwarding is very useful for traversing firewalls. Of course, you
don't need to use lsh-style forwarding just to get out, there are other
tools like HTTPTunnel for that. But <code>lsh</code> helps you get out
through the firewall in a secure way.

     <li>Port forwarding is done in addition to anything else <code>lsh</code> is
doing. In the example above, a tunnel is set up, but <code>lsh</code> will
also start an interactive shell for you. Just as if the <code>-L</code>
option was not present. If this is not what you want, the <code>-N</code> or
<code>-B</code> option is for you (see <a href="#Invoking%20lsh">Invoking lsh</a>)
</ul>

   <p>Remote forwarding is similar, but asks the <em>remote</em> machine to
listen on a port. An example of remote forwarding is

<pre class="example">     lsh -g -R 8080:localhost:80 sara.lysator.liu.se
     </pre>

<p>This asks the remote machine to listen on port 8080 (note that you are
probably not authorized to listen on port 80). Whenever someone
connects, the connection is tunnelled to your local machine, and
directed to port 80 on the same machine. Note the use of <code>-g</code>;
the effect is to allow anybody in the world to use the tunnel to connect
to your local webserver.

   <p>The same considerations that apply to forwarded local ports apply also to
forwarded remote ports.

   <p>At last, you can use any number of <code>-L</code> and <code>-R</code> options
on the same command line.

<div class="node">
<p><hr>
Node:&nbsp;<a name="lshd%20basics">lshd basics</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#public-key">public-key</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#tcpip%20forwarding">tcpip forwarding</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting%20started">Getting started</a>
<br>
</div>

<h3 class="section"><code>lshd</code> basics</h3>

<p>There are no global configuration files for <code>lshd</code>; all
configuration is done with command line options (see <a href="#Invoking%20lshd">Invoking lshd</a>).

   <p>To run <code>lshd</code>, you must first create a hostkey, usually stored in
<code>/etc/lsh_host_key</code>. To do this, run

<pre class="example">     lsh-keygen --server | lsh-writekey --server
     </pre>

<p>This will also create a file <code>/etc/lsh_host_key.pub</code>,
containing the corresponding public key.

   <p>A typical command line for starting lshd in daemon mode is simply

<pre class="example">     lshd --daemonic
     </pre>

   <p>You can find init script for <code>lshd</code> tailored for Debian's and
RedHat's GNU/Linux systems in the <code>contrib</code> directory.

   <p>It is also possible to let <code>init</code> start <code>lshd</code>, by
adding it in <code>/etc/inittab</code>.

<div class="node">
<p><hr>
Node:&nbsp;<a name="public-key">public-key</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#srp">srp</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#lshd%20basics">lshd basics</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting%20started">Getting started</a>
<br>
</div>

<h3 class="section">Using public-key user authentication</h3>

<p>Public-key user authentication is a way to authenticate for login,
without having to type any passwords. There are two steps: Creating a
key pair, and authorizing the public key to the systems where you want
to log in.

   <p>To create a keypair, run

<pre class="example">     lsh-keygen | lsh-writekey
     </pre>

<p>This can take some time, but in the end it creates two files
<code>~/.lsh/identity</code> and <code>~/.lsh/identity.pub</code>.

   <p>If you want to use the key to login to some other machine, say
<code>sara</code>, you can do that by first copying the key,

<pre class="example">     lsh sara.lysator.liu.se '&gt;my-key.pub' &lt; ~/.lsh/identity.pub
     </pre>

<p>then authorizing it by executing, on <code>sara</code>,

<pre class="example">     lsh-authorize my-key.pub
     </pre>

   <p>By default, <code>lsh-writekey</code> encrypts the private key using a
passphrase. This gives you some protection if a backup tape gets into
the wrong hands, or you use NFS to access the key file in your home
directory. If you want an unencrypted key, pass the flag <code>-c
none</code> to <code>lsh-writekey</code>.

   <p>For security reasons, you should keep the private key
<code>~/.lsh/identity</code> secret. This is of course particularly important
if the key is unencrypted; in that case, anybody who can read the file
will be able to login in your name to any machine where the
corresponding public key is registered as an authorized key.

   <p>Naturally, you should also make sure not to authorize any keys but your
own. For instance, it is inappropriate to use an insecure mechanism such
as unauthenticated email, <code>ftp</code> or <code>http</code> to transfer your
public key to the machines where you want to authorize it.

   <p>If you have accounts on several systems, you usually create one keypair
on each of the systems, and on each system you authorize some or all of
your other public keys for login.

<div class="node">
<p><hr>
Node:&nbsp;<a name="srp">srp</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#sexp">sexp</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#public-key">public-key</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting%20started">Getting started</a>
<br>
</div>

<h3 class="section">Using <small>SRP</small> authentication</h3>

<p>The Secure Remote Password protocol is a fairly new protocol that
provides mutual authentication based on a password. To use it, you must
first choose a secret password. Next, you create a <dfn>password
verifier</dfn> that is derived from the password. The verifier is stored on
the target machine (i.e. the machine you want to log in to).

   <p>To create a verifier, you run the <code>srp-gen</code> program and type
your new password. You have to do it on either the target machine,
redirecting the output to ~/.lsh/srp-verifier, or you can generate it on
some other machine and copy it to the target.

   <p>The main advantage of using <small>SRP</small> is that you use the password
not only to get access to the remote machine, but you also use it to
authenticate the remote machine. I.e. you can use it to connect
securely, <em>without</em> having to know any hostkeys or fingerprints
beforehand!

   <p>For instance, you could connect using <small>SRP</small> to fetch the hostkey
fingerprint for the remote machine, as a kind of bootstrapping
procedure, and then use traditional authentication methods for further
connections.

   <p>For this to work, the verifier <em>must</em> be kept <em>secret</em>. If the
enemy gets your verifier, he can mount some attacks:

     <ul>
<li>He can mount a <dfn>dictionary attack</dfn> on your password, i.e. generate a
large list of likely password and check if any of them matches yours.

     <li>He can impersonate the server. That means that if you try to connect to
the remote machine using <small>SRP</small>, and the attacker can intercept
your connection (e.g. by attacking the name resolution or routing
system) he can successfully pretend to be the real server. 
</ul>

   <p>If you use <small>SRP</small> to get the hostkey or fingerprint for the
remote machine, as outlined above, the impersonation attack destroys
security, you could just as well connect the hostkey presented by the
remote server without verifying it at all.

   <p>If you use <small>SRP</small> exclusively, the situation seems somewhat
different. As far as I can see, an attacker knowing your verifier can
not mount a traditional man-in-the-middle-attack: He can play the
server's part when talking to you, but in order to play your part when
talking to the real server, he needs to know your password as well.

   <p><small>SRP</small> support is disabled by default, but can be enabled by the
<code>--srp-keyexchange</code> option to <code>lshd</code> and <code>lsh</code>
(naturally, it won't be used unless enabled on both sides). At the time
of this writing, <small>SRP</small> is too new to be trusted by conservative
cryptographers (and remember that conservatism is a virtue when it comes
to security).

   <p>And even if <small>SRP</small> in itself is secure, the way <code>lsh</code>
integrates it into the <code>ssh</code> protocol has not had much peer review. 
The bottom line of this disclaimer is that the <small>SRP</small> support in
<code>lsh</code> should be considered experimental.

   <p>As far as I know, using <small>SRP</small> as a host authentication mechanism
is not supported by any other <code>ssh</code> implementation. The protocol
<code>lsh</code> uses is described in the <code>doc/srp-spec.txt</code>. 
Implementations that use <small>SRP</small> only as a user authentication
mechanism are not compatible with <code>lsh</code>.

<div class="node">
<p><hr>
Node:&nbsp;<a name="sexp">sexp</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Converting%20keys">Converting keys</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#srp">srp</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting%20started">Getting started</a>
<br>
</div>

<h3 class="section">Examining keys and other sexp files</h3>

<p>Keys and most other objects <code>lsh</code> needs to store on disk are
represented as so called S-expressions or <dfn>sexps</dfn> for short. 
S-expressions have their roots in the Lisp world, and a variant of them
in used in the Simple Public Key Infrastructure (<small>SPKI</small>). 
Currently, <code>lsh</code>'s support for <small>SPKI</small> is quite limited,
but it uses <small>SPKI</small>'s formats for keys and Access Control Lists
(<small>ACL</small>:s).

   <p>There are several flavours of the sexp syntax:

     <ul>
<li>The canonical syntax is somewhere between a text and a binary format,
and is extremely easy for programs to read and write.

     <li>The transport syntax, which is suitable when embedding sexps in text
files. It is essentially the canonical representation, encoded using
base64.

     <li>The advanced syntax, which is intended for humans to read and write, and
bears some resemblance to Lisp expressions. 
</ul>

   <p>To see what your <code>~/.lsh/identity.pub</code> file really contains, try

<pre class="example">     sexp-conv &lt; ~/.lsh/identity.pub
     </pre>

   <p>The <code>sexp-conv</code> program can also be used to computes
fingerprints. The fingerprint of a key (or any sexp, for that matter) is
simply the hash of its canonical representation. For example,

<pre class="example">     sexp-conv --hash &lt;/etc/lsh_host_key.pub
     </pre>

   <p>This flavour of fingerprints is different from the ssh
fingerprint convention, which is based on a hash of the key expressed in
ssh wire format. To produce ssh standard fingerprints, use
<code>lsh-export-key --fingerprint</code>.

<div class="node">
<p><hr>
Node:&nbsp;<a name="Converting%20keys">Converting keys</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#sexp">sexp</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Getting%20started">Getting started</a>
<br>
</div>

<h3 class="section">Converting keys from <code>ssh2</code> and OpenSSH</h3>

<p>If you are already using <code>ssh2</code> or OpenSSH, and have created one
or more personal keypairs, you need to convert the public keys to
<code>lsh</code>'s format before you can authorize them. Use the supplied
<code>ssh-conv</code> script,

<pre class="example">     ssh-conv &lt;openssh-key.pub &gt;new-key.pub
     </pre>

   <p>You can then use the usual <code>lsh-authorize</code> on the converted
keys. <code>ssh-conv</code> supports both <small>DSA</small> and <code>RSA</code> keys.

   <p>Conversion of keys the other way is also possible, by using the
<code>lsh-export-key</code> program. It reads a public key in
the  <small>SPKI</small> format used by <code>lsh</code> on stdin, and writes the key in
<code>ssh2</code>/OpenSSH format on stdout.

   <p>If you want to use your <code>lsh</code> key to log in to another system
running and OpenSSH server, you can do like this:

<pre class="example">     lsh-export-key --openssh &lt; .lsh/identity.pub &gt;sshkey
     
     </pre>

   <p>And on the other machine, after having somehow copied the sshkey
file, just add it to the end of your <code>authorized_keys</code> file:

<pre class="example">     cat sshkey &gt;&gt; ~/.ssh/authorized_keys
     </pre>

   <p><code>lsh-export-key</code> can also be used to check the fingerprint of
keys (just like <code>ssh-keygen</code>).

<pre class="example">     lsh-export-key --fingerprint &lt; /etc/lsh_host_key.pub
     </pre>

   <p>show the <small>MD5</small> and Bubble babble
fingerprint of the server public key.

   <p>There are currently no tools for converting private keys.

<div class="node">
<p><hr>
Node:&nbsp;<a name="Invoking%20lsh">Invoking lsh</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Invoking%20lshg">Invoking lshg</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Getting%20started">Getting started</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<h2 class="chapter">Invoking <code>lsh</code></h2>

<p><a name="lsh-usage"></a>

   <p>You use <code>lsh</code> to login to a remote machine. Basic usage is

   <p><code>lsh [-p </code><var>port number</var><code>] sara.lysator.liu.se</code>

   <p>which attempts to connect, login, and start an interactive shell on the
remote machine. Default <var>port number</var> is whatever your system's
<code>/etc/services</code> lists for <code>ssh</code>. Usually, that is port 22.

   <p>There is a plethora of options to <code>lsh</code>, to let you configure where
and how to connect, how to authenticate, and what you want to do once
properly logged in to the remote host. Many options have both long and
short forms. This manual does not list all variants; for a full listing
of supported options, use <code>lsh --help</code>.

   <p>Note that for many of the options to <code>lsh</code>, the ordering of the
options on the command line is important.

<ul class="menu">
<li><a accesskey="1" href="#Algorithm%20options">Algorithms</a>:   Selecting algorithms. 
<li><a accesskey="2" href="#Hostauth%20options">Hostauth options</a>: 
<li><a accesskey="3" href="#Userauth%20options">Userauth options</a>: 
<li><a accesskey="4" href="#Action%20options">Actions</a>:       What to do after login. 
<li><a accesskey="5" href="#Verbosity%20options">Messages</a>:   Tuning the amount of messages. 
</ul>

<div class="node">
<p><hr>
Node:&nbsp;<a name="Algorithm%20options">Algorithm options</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Hostauth%20options">Hostauth options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Invoking%20lsh">Invoking lsh</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Invoking%20lsh">Invoking lsh</a>
<br>
</div>

<h3 class="section">Algorithm options</h3>

<p>Before a packet is sent, each packet can be compressed, authenticated,
and encrypted, in that order. When the packet is received, it is first
decrypted, next it is checked that it is authenticated properly, and
finally it is decompressed. The algorithms used for this are negotiated
with the peer at the other end of the connection, as a part of the
initial handshake and key exchange.

   <p>Each party provides a list of supported algorithms, and the first
algorithm listed by the client, which is also found on the server's
list, is selected. Note that this implies that order in which algorithms
are listed on the server's list doesn't matter: if several algorithms
are present on both the server's and the client's lists, it's the
client's order that determines which algorithm is selected.

   <p>Algorithms of different types, e.g. data compression and message
authentication, are negotiated independently. Furthermore, algorithms
used for transmission from the client to the server are independent of
the algorithms used for transmission from the server to the client. 
There are therefore no less than six different lists that could be
configured at each end.

   <p>The command line options for lsh and lshd don't let you specify
arbitrary lists. For instance, you can't specify different preferences
for sending and receiving.

   <p>There is a set of default algorithm preferences. When you use a command
line option to say that you want to use <var>algorithm</var> for one of the
algorithms, the default list is replaced with a list containing the
single element <var>algorithm</var>. For example, if you use <code>-c
arcfour</code> to say that you want to use <code>arcfour</code> as the encryption
algorithm, the connection will either end up using <code>arcfour</code>, or
algorithm negotiation will fail because the peer doesn't support
<code>arcfour</code>.

   <p><table><tr align="left"><td valign="top">Option
  </td><td valign="top">Algorithm type </td><td valign="top">Default </td><td valign="top">
<br></td></tr><tr align="left"><td valign="top"><code>-z</code> </td><td valign="top">Data compression
  </td><td valign="top"><code>none</code>, <code>zlib</code>

</td><td valign="top">The default preference list supports zlib compression, but
prefers not to use it.

<br></td></tr><tr align="left"><td valign="top"><code>-c</code> </td><td valign="top">Encryption
  </td><td valign="top"><code>aes256-cbs</code>, <code>3dec-cbc</code>, <code>blowfish-cbc</code>, <code>arcfour</code>

</td><td valign="top">The default encryption algorithm is aes256. The default list
includes only quite old and well studied algorithms. There is a special
algorithm name <code>all</code> to enable all supported encryption algorithms
(except <code>none</code>).

<br></td></tr><tr align="left"><td valign="top"><code>-m</code> </td><td valign="top">Message Authentication
  </td><td valign="top"><code>hmac-sha1</code>, <code>hmac-md5</code>

</td><td valign="top">Both supported message authentication algorithms are of the
<small>HMAC</small> family.
   <br></td></tr></table>

   <p>As a special case, <code>-z</code> with no argument changes the compression
algorithm list to <code>zlib</code>, <code>none</code>, which means that you want to
use <code>zlib</code> if the other end supports it. This is different from
<code>-zzlib</code> which causes the negotiation to fail if the other end
doesn't support <code>zlib</code>. A somewhat unobvious consequence of
<code>-z</code> having an <em>optional</em> argument is that if you provide an
argument, it must follow directly after the option letter, no spaces
allowed.

<div class="node">
<p><hr>
Node:&nbsp;<a name="Hostauth%20options">Hostauth options</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Userauth%20options">Userauth options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Algorithm%20options">Algorithm options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Invoking%20lsh">Invoking lsh</a>
<br>
</div>

<h3 class="section">Host authentication options</h3>

<p>As described earlier (see <a href="#Threats">Threats</a>), proper authentication of the
remote host is crucial to protect the connection against
man-in-the-middle attacks. By default, <code>lsh</code> verifies the server's
claimed host key against the <dfn>Access Control Lists</dfn> in
<code>~/.lsh/host-acls</code>. If the remote host cannot be authenticated,
the connection is dropped.

   <p>The options that change this behaviour are

     <dl>
<dt><code>--host-db</code>
     <dd>Specifies the location of the <small>ACL</small> file.

     <br><dt><code>--sloppy-host-authentication</code>
     <dd>Tell <code>lsh</code> not to drop the connection if the server's key can not
be authenticated. Instead, it displays the fingerprint of the key, and
asks if it is trusted. The received key is also appended to the file
<code>~/.lsh/captured_keys</code>. If run in quiet mode, <code>lsh -q
--sloppy-host-authentication</code>, <code>lsh</code> connects to any host, no
questions asked.

     <br><dt><code>--strict-host-authentication</code>
     <dd>Disable sloppy operation (this is the default behaviour).

     <br><dt><code>--capture-to</code>
     <dd>Use some other file than <code>~/.lsh/captured_keys</code>. For example,

     <pre class="example">          lsh --sloppy-host-authentication --capture-to ~/.lsh/host-acls
          </pre>

     <p>makes <code>lsh</code> behave more like the <code>ssh</code> program.

     <br><dt><code>--srp-keyexchange</code>
     <dd>Try using <small>SRP</small> for keyexchange and mutual authentication.

   </dl>

<div class="node">
<p><hr>
Node:&nbsp;<a name="Userauth%20options">Userauth options</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Action%20options">Action options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Hostauth%20options">Hostauth options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Invoking%20lsh">Invoking lsh</a>
<br>
</div>

<h3 class="section">User authentication options</h3>

     <dl>

     <br><dt><code>-l</code>
     <dd>Provide a name to use when logging in. By default, the value of the
<code>LOGNAME</code> environment variable is used.

     <br><dt><code>-i</code>
     <dd>Try the keys from this file to log in. By default, <code>lsh</code> uses
<code>~/.lsh/identity</code>, if it exists. It ought to be possible to use
several <code>-i</code> options to use more than one file, but that is
currently not implemented.

     <br><dt><code>--no-publickey</code>
     <dd>Don't attempt to log in using public key authentication.

</dl>

<div class="node">
<p><hr>
Node:&nbsp;<a name="Action%20options">Action options</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Verbosity%20options">Verbosity options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Userauth%20options">Userauth options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Invoking%20lsh">Invoking lsh</a>
<br>
</div>

<h3 class="section">Action options</h3>

<p>There are many things <code>lsh</code> can do once you are logged in. There
are two types of options that control this: <dfn>actions</dfn> and
<dfn>action modifiers</dfn>. For short options, actions use uppercase letters
and modifiers use lowercase.

   <p>For each modifier <code>--foo</code> there's also a negated form
<code>--no-foo</code>. Options can also be negated by preceding it with the
special option <code>-n</code>. This is mainly useful for negating short
options. For instance, use <code>-nt</code> to tell <code>lsh</code> not to
request a remote pseudo terminal. Each modifier and its negation can be
used several times on the command line. For each action, the latest
previous modifier of each pair apply.

   <p>First, the actions:

     <dl>

     <br><dt><code>-L</code>
     <dd>Requests forwarding of a local port. This option takes a mandatory
argument of the form
<var>listen-port</var>:<var>target-host</var>:<var>target-port</var>. This option tells
<code>lsh</code> to listen on <var>listen-port</var> on the local machine. When
someone conects to that port, <code>lsh</code> asks the remote server to open
a connection to <var>target-port</var> on <var>target-host</var>, and if it
succeeds, the two connections are joined together through an the
<code>lsh</code> connection. Both port numbers should be given in decimal.

     <br><dt><code>-R</code>
     <dd>Requests forwarding of a remote port. It takes one mandatory argument,
just like <code>-L</code>. But in this case <code>lsh</code> asks the
<em>remote</em> server to listen on <var>listen-port</var>. When someone
connects to the remote hosts, the server will inform the local
<code>lsh</code>. The local <code>lsh</code> then connects to <var>target-port</var> on
<var>target-host</var>.

     <br><dt><code>-D</code>
     <dd>Requests SOCKS-style forwarding. It takes one optional argument, the
port number to use for the SOCKS proxy (default is 1080). Other
applications can then use socks version 4 or version 5, to open
outgoing connections which are forwarded via the SSH connection. Note
that for short options the port number must be in the same argument if given
(i.e. <code>-D1080</code> is correct, <code>-D 1080</code> is not).

     <br><dt><code>-E</code>
     <dd>This option takes one mandatory argument, which is a command line to be
executed on the remote machine.

     <br><dt><code>-S</code>
     <dd>Start an interactive shell on the remote machine.

     <br><dt><code>-G</code>
     <dd>Open a gateway on the local machine. A gateway is a local socket,
located under /tmp, that can be used for controlling and using the ssh
connection. It is protected using the ordinary file permissions.

     <br><dt><code>-N</code>
     <dd>This is a no-operation action. It inhibits the default action, which is
to start an interactive shell on the remote machine. It is useful if you
want to set up a few forwarded tunnels or a gateway, and nothing more.

     <br><dt><code>-B</code>
     <dd>Put the client into the background after key exchange and
user authentication. Implies <code>-N</code>

     <br><dt><code>--subsystem</code>
     <dd>Specifies a subsystem to connect to, implies <code>--no-pty</code>. Example usage:
<code>--subsystem=sftp</code>

   </dl>

   <p>If there are trailing arguments after the name of the remote system,
this is equivalent to a <code>-E</code> option, with a command string
constructed by catenating all the remaining arguments, separated by
spaces. This implies that the arguments are usually expanded first by
the local shell, and then the resulting command string is interpreted
again by the remote system.

   <p>If there are no trailing arguments after the name of the remote system,
and the <code>-N</code> option is not given, the default action is to start
a shell on the remote machine. I.e. this is equivalent to the
<code>-S</code> option.

   <p>There are a few supported modifiers:

     <dl>

     <br><dt><code>-t</code>
     <dd>Request a pseudo terminal. <code>lsh</code> asks the remote system to allocate
a pseudo terminal. If it succeeds, the local terminal is set to raw
mode. The default behaviour is to request a pty if and only if the
local <code>lsh</code> process has a controlling terminal. This modifier
applies to actions that create remote processes, i.e. <code>-E</code> and
<code>-S</code>, as well as the default actions.

     <p>Currently, this option is ignored if there is no local terminal.

     <br><dt><code>-x</code>
     <dd>Request <small>X</small> forwarding. Applies to the <code>-E</code> and
<code>-S</code> and the default actions.

     <br><dt><code>--stdin</code>
     <dd>Redirect the stdin of a remote process from a given, local, file. 
Default is to use <code>lsh</code>'s stdin for the first process, and
<code>/dev/null</code> for the rest. This option applies to the <code>-E</code>
and <code>-S</code> options as well as to the default actions. The option
applies to only one process; as soon as it is used it is reset to the
default.

     <br><dt><code>--stdout</code>
     <dd>Redirect the stdout of a remote process to a given, local, file. Default
is to use <code>lsh</code>'s stdout. Like <code>--stdin</code>, it is reset
after it is used.

     <br><dt><code>--stderr</code>
     <dd>Redirect the stdout of a remote process to a given, local, file. 
Analogous to the <code>--stdout</code> option.

     <br><dt><code>--detach</code>
     <dd>Detach from terminal at session end.

     <br><dt><code>--write-pid</code>
     <dd>Applies to <code>-E</code>. Write PID of backgrounded process to stdout.

     <br><dt><code>-e</code>
     <dd>Set the escape character (use "none") to disable. Default is "~"
if a tty is allocated and "none" otherwise.

     <br><dt><code>-g</code>
     <dd>Remote peers, aka global forwarding. This option applies to the
forwarding actions, i.e. <code>-L</code>, <code>-R</code> and <code>-D</code>. By
default, only connections to the loopback interface, ip 127.0.0.1, are
forwarded. This implies that only processes on the same machine can use
the forwarded tunnel directly. If the -g modifier is in effect, the
forwarding party will listen on <em>all</em> network interfaces.

   </dl>

<div class="node">
<p><hr>
Node:&nbsp;<a name="Verbosity%20options">Verbosity options</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Action%20options">Action options</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Invoking%20lsh">Invoking lsh</a>
<br>
</div>

<h3 class="section">Verbosity options</h3>

<p>These options determines what messages <code>lsh</code> writes on
its stderr.

     <dl>

     <br><dt><code>-q</code>
     <dd>Quiet mode. Disables all messages and all questions, except password
prompts and fatal internal errors.

     <br><dt><code>-v</code>
     <dd>Verbose mode. Makes <code>lsh</code> a little more verbose. The intention is
to provide information that is useful for ordinary trouble shooting,
and makes sense also to those not familiar with <code>lsh</code> internals.

     <br><dt><code>--trace</code>
     <dd>Trace mode. Prints some internal information to aid tracking
<code>lsh</code>'s flow of control.

     <br><dt><code>--debug.</code>
     <dd>Debug mode. Dumps <em>a lot</em> of information, including dumps of all
sent and received packets. It tries to avoid dumping highly sensitive data,
such as private keys and the contents of <code>SSH_MSG_USERAUTH_REQUEST</code>
messages, but you should still use it with care.

     <br><dt><code>--log-file</code>
     <dd>This option redirects all messages to a file. Takes one mandatory
argument: The name of that file.

   </dl>

   <p>Note that all these options are orthogonal. If you use <code>--trace</code>,
you usually want to add <code>-v</code> as well; <code>--trace</code> does not
do that automatically.

<div class="node">
<p><hr>
Node:&nbsp;<a name="Invoking%20lshg">Invoking lshg</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Invoking%20lshd">Invoking lshd</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Invoking%20lsh">Invoking lsh</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<h2 class="chapter">Invoking <code>lshg</code></h2>

<p><a name="lshg-usage"></a>

   <p>You use <code>lshg</code> to login to a remote machine to which you have
previously used <code>lsh</code> to set up a gateway (see <a href="#Action%20options">Action options</a>). Its usage is very similar to that of <code>lsh</code>
(see <a href="#Invoking%20lsh">Invoking lsh</a>), except that some options are not available.

   <p>Basic usage is

   <p><code>lshg [-l </code><var>username</var><code>] </code><var>host</var><code></code>

   <p>which attempts to connect to the gateway that should previously have
been established by running <code>lsh [-l </code><var>username</var><code>] -G </code><var>host</var><code></code>)

   <p>The <var>username</var> and <var>host</var> are used to locate the gateway. The
default value for <var>username</var> is determined in the same way as for
<code>lsh</code> (see <a href="#Invoking%20lsh">Invoking lsh</a>).

   <p>As <code>lshg</code> uses almost the same options as <code>lsh</code>
(see <a href="#Invoking%20lsh">Invoking lsh</a>), only options that are not available or have
a different meaning in <code>lshg</code> are listed here.

   <p>The algorithm options (see <a href="#Algorithm%20options">Algorithm options</a>) as well as most of
the userauth (see <a href="#Userauth%20options">Userauth options</a>) and hostauth (see <a href="#Hostauth%20options">Hostauth options</a>) are not available in <code>lshg</code> as they are only used by
session setup, which is already handled by <code>lsh</code>.

   <p>Due to technical reasons, <small>X11</small>-forwarding cannot be performed by
<code>lshg</code>, thus the <code>--x11-forward</code> option (see <a href="#Action%20options">Action options</a>) is not
available.

   <p>To summarize, these are the options that are new, not available or
that have different meanings:

     <dl>
<dt><code>-G</code>
     <dd>For <code>lsh</code> <code>-G</code> requests a gateway to be set up. For
<code>lshg</code> it means that if no usable gateway is found
<code>lsh</code> should be launched with the same arguments instead.

     <br><dt><code>--send-debug</code>
     <dd>Not available in <code>lsh</code>. Sends a <code>debug</code> message to the remote machine.

     <br><dt><code>--send-ignore</code>
     <dd>Not available in <code>lsh</code>.  Sends a <code>ignore</code> message to the remote machine.

     <br><dt><code>-x</code>
     <dd>(<code>--x11-forward</code>) Not available in <code>lshg</code>.

     <br><dt><code>-c</code>
     <dd>(<code>--crypto</code>) Not available in <code>lshg</code>.

     <br><dt><code>-z</code>
     <dd>(<code>--compression</code>) Not available in <code>lshg</code>.

     <br><dt><code>-m</code>
     <dd>(<code>--mac</code>) Not available in <code>lshg</code>.

     <br><dt><code>--hostkey-algorithm</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>--capture-to</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>--strict-host-authentication</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>--sloppy-host-authentication</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>--host-db</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>--publickey</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>--no-publickey</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>--dh-keyexchange</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>--no-dh-keyexchange</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>--srp-keyexchange</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>--no-srp-keyexchange</code>
     <dd>Not available in <code>lshg</code>.

     <br><dt><code>-i</code>
     <dd><code>--identity</code> Not available in <code>lshg</code>.

   </dl>

<div class="node">
<p><hr>
Node:&nbsp;<a name="Invoking%20lshd">Invoking lshd</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Files%20and%20environment%20variables">Files and environment variables</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Invoking%20lshg">Invoking lshg</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<h2 class="chapter">Invoking <code>lshd</code></h2>

<p><a name="lshd-usage"></a>

   <p><code>lshd</code> is a server that accepts connections from clients
speaking the Secure Shell Protocol. It is usually started automatically
when the systems boots, and runs with root privileges. However, it is
also possible to start <code>lshd</code> manually, and with user
privileges.

   <p>There are currently no configuration files. Instead, command line options
are used to tell <code>lshd</code> what to do. Many options have <code>--foo</code>
and <code>--no-foo</code> variants. Options specifying the default behaviour
are not listed here.

   <p>Some of the options are the shared with <code>lsh</code>. In particular, see
<a href="#Algorithm%20options">Algorithm options</a> and <a href="#Verbosity%20options">Verbosity options</a>.

   <p>Options specific to the <code>lshd</code> server are:

     <dl>

     <br><dt><code>-p</code>
     <dd>Port to listen to. The mandatory argument is a decimal port number or a
service name. Default is "ssh", usually port 22.

     <p>It should also be possible to use several -p options as a convenient way
to make lshd listen on several ports on each specified (or default)
interface, but that is not yet implemented.

     <p>Note that if you use both <code>-p</code> and <code>--interface</code>, the
order matters.

     <br><dt><code>--interface</code>
     <dd>Network interface to listen on. By default, <code>lshd</code> listens on all
interfaces. An interface can be specified as a DNS name, a literal IPv4
address, or a literal IPv6 address enclosed in square brackets. It can
optionally be followed by a colon and a port number or service name. If
no port number or service is specified, the default or the value from a
<em>preceding</em> <code>-p</code> is used.

     <p>Some examples: <code>--interface=localhost</code>,
<code>--interface=1.2.3.4:443</code>, <code>--interface=[aaaa::bbbb]:4711</code>. To
make <code>lshd</code> listen on several ports and interfaces at the same
time, just use several <code>--interface</code> options on the command line.

     <br><dt><code>-h</code>
     <dd>Location of the server's private key file. By default,
<code>/etc/lsh_host_key</code>.

     <br><dt><code>--daemonic</code>
     <dd>Enables daemonic mode. <code>lshd</code> forks into the background,
redirects its stdio file descriptors to <code>/dev/null</code>, changes its
working directory to <code>/</code>, and redirects any diagnostic or debugging
messages via syslog.

     <p><code>lshd</code> should be able to deal with the environment it inherits
if it is started by <code>init</code> or <code>inetd</code>, but this is not
really tested.

     <br><dt><code>--pid-file</code>
     <dd>Creates a locked pid file, to make it easier to write start and stop
scripts for <code>lshd</code>. The mandatory argument provides the filename. 
This option is enabled by default when operating in daemonic mode, and
the default filename is <code>/var/run/lshd.pid</code>.

     <br><dt><code>--no-syslog</code>
     <dd>Disable the use of the syslog facility. Makes sense only together with
<code>--daemonic</code>

     <br><dt><code>--enable-core</code>
     <dd>By default, <code>lshd</code> disables core dumps, to avoid leaking sensitive
information. This option changes that behaviour, and allows <code>lshd</code>
to dump core on fatal errors.

     <br><dt><code>--no-password</code>
     <dd>Disable the "password" user authentication mechanism.

     <br><dt><code>--no-publickey</code>
     <dd>Disable the "publickey" user authentication mechanism.

     <br><dt><code>--root-login</code>
     <dd>Enable root login. By default, root can not log in using <code>lshd</code>.

     <br><dt><code>--login-auth-mode</code>
     <dd>This option is highly experimental. Bypass <code>lshd</code>'s user
authentication, and allow users to spawn their login-shell without any
authentication. Usually combined with <code>--login-shell</code>, to set the
login shell to a program that performce password authentication.

     <br><dt><code>--kerberos-passwords</code>
     <dd>Verify passwords against the kerberos database. This is implemented
using the <code>lsh-krb-checkpw</code> helper program. Note that this does
<em>not</em> use the Kerberos infrastructure in the Right Way. Experimental.

     <br><dt><code>--password-helper</code>
     <dd>Tells <code>lshd</code> to use a helper program for verifying passwords. 
This is a generalization of <code>--kerberos-passwords</code>, and it could
be used for verifying passwords against any password database. See the
source files <code>lsh-krb-checkpw.c</code> and <code>unix_user.c</code> for
details.

     <br><dt><code>--login-shell</code>
     <dd>Use the specified program as the login shell for all users, overriding
the login shell in the passwd database.

     <br><dt><code>--srp-keyexchange</code>
     <dd>Enable <small>SRP</small> keyexchange and user authentication.

     <br><dt><code>--no-pty-support</code>
     <dd>Disable support for pseudo terminals.

     <br><dt><code>--no-tcp-forward</code>
     <dd>Disable support for tcp forwarding, in both directions.

     <br><dt><code>--subsystems</code>
     <dd>Specifies a list of subsystems and corresponding
programs. 
Example usage: <code>--subsystems=sftp=/usr/sbin/sftp-server,foosystem=/usr/bin/foo</code>

   </dl>

<div class="node">
<p><hr>
Node:&nbsp;<a name="Files%20and%20environment%20variables">Files and environment variables</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Terminology">Terminology</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Invoking%20lshd">Invoking lshd</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<h2 class="chapter">Files and environment variables</h2>

<p>This chapters describes all files and all environment variables that
are used by <code>lsh</code>, <code>lshd</code>, and related programs.

   <p>There are a few environment variables that modifies the behaviour of
the <code>lsh</code> programs. And there are also a handful of variables
that are setup by <code>lshd</code> when starting user processes.

     <dl>
<dt><code>DISPLAY</code>
     <dd>When <small>X</small>-forwarding is enabled, <code>DISPLAY</code> specifies the
local display. Used by <code>lsh</code>.

     <br><dt><code>HOME</code>
     <dd>User's home directory. Determines where client programs looks for the
<code>~/.lsh</code> directory. When <code>lshd</code> starts a user program, it
sets <code>HOME</code> from the value in the <code>/etc/passwd</code> file, except
if <code>lshd</code> is running as an ordinary user process. In the
latter case, the new process inherits <code>lsh</code>'s own value of
<code>HOME</code>.

     <br><dt><code>LOGNAME</code>
     <dd>The user's log in name. Used as the default name for logging into
remote systems. Set by <code>lshd</code> when starting new processes.

     <br><dt><code>LSH_YARROW_SEED_FILE</code>
     <dd>If set, it points out the location of the seed-file for the randomness
generator. Recognized both by <code>lshd</code> and the client programs.

     <br><dt><code>LSHFLAGS</code>
     <dd>If set, lsh will parse any options as had they been given on the
command line.

     <br><dt><code>LSHGFLAGS</code>
     <dd>If set, lshg will parse any options as had they been given on the
command line.

     <br><dt><code>POSIXLY_CORRECT</code>
     <dd>Affects the command line parsing of programs which by default accept
options mixed with arguments.

     <br><dt><code>SEXP_CONV</code>
     <dd>The location of the <code>sexp-conv</code> program. If not set, the default
<code>$prefix/bin/sexp-conv</code> is used.

     <br><dt><code>SSH_CLIENT</code>
     <dd>This variable may be set by lshd for established sessions. If it is set
it consists of three parts separated by whitespace, the first part
contains the address of the connecting client. The second part
contains the tcp port used on the connecting client and the third part
contains the tcp port used on the server.

     <br><dt><code>SSH_TTY</code>
     <dd>This variable may be set by lshd for established sessions. If it is set
it is the name of the tty allocated.

     <br><dt><code>SHELL</code>
     <dd>User's login shell. When <code>lshd</code> starts a user process, it sets
<code>SHELL</code> to the value in <code>/etc/passwd</code>, unless overridden by
the <code>--login-shell</code> command line option.

     <br><dt><code>TERM</code>
     <dd>The type of the local terminal. If the client requests a pty for a
remote process, the value of <code>TERM</code> is transferred from client to
server.

     <br><dt><code>TMPDIR</code>
     <dd>Determines where the unix socket used by <code>lshg</code> is located in
the filesystem.

     <br><dt><code>TZ</code>
     <dd>Time zone. Processes started by <code>lshd</code> inherit the value of
this variable from the server process.

   </dl>

   <p>Files used by the lsh client, stored in the <code>~/lsh</code> directory:

     <dl>
<dt><code>captured_keys</code>
     <dd>Keys for remote hosts, saved when running <code>lsh
--sloppy-host-authentication</code>. Or more precicely, each key is stored
together with an as SPKI (Simple Public Key Intrastructure) ACL:s
(Access Control Lists).

     <br><dt><code>identity</code>
     <dd>Your private key file. Usually created by <code>lsh-keygen |
lsh-writekey</code>. Read by <code>lsh</code>. Should be kept secret.

     <br><dt><code>identity.pub</code>
     <dd>The corresponding public key. You can copy this file to other systems
in order to authorize the private key to login (see <a href="#Converting%20keys">Converting keys</a>).

     <br><dt><code>host-acls</code>
     <dd>Host keys (or more precisely, ACL:s) that lsh considers authentic. 
Entries have the same format as in <code>captured_keys</code>.

     <br><dt><code>yarrow-seed-file</code>
     <dd>The seed file for the randomness generator. Should be kept secret.

   </dl>

   <p>Files used by <code>lshd</code>, some of which are read from user home
directories:

     <dl>
<dt><code>/etc/lsh_host_key</code>
     <dd>The server's private host key.

     <br><dt><code>/etc/lsh_host_key.pub</code>
     <dd>The corresponding public key.

     <br><dt><code>/var/spool/lsh/yarrow-seed-file</code>
     <dd>The seed-file for <code>lshd</code>'s randomness generator.

     <br><dt><code>~/.lsh/authorized_keys</code>
     <dd>This is a directory that keeps a "database" of keys authorized for
login. With the current implementation, a key is authorized for login
if and only if this directory contains a file with a name which is the
SHA1 hash of the key. The usual way to create files is by running the
script <code>lsh-authorize</code>.

     <br><dt><code>~/.lsh/srp-verifier</code>
     <dd>If you use the experimental support for <small>SRP</small> (see <a href="#srp">srp</a>),
the server reads a user's <small>SRP</small> verifier from this file. 
</dl>

<div class="node">
<p><hr>
Node:&nbsp;<a name="Terminology">Terminology</a>,
Next:&nbsp;<a rel="next" accesskey="n" href="#Concept%20Index">Concept Index</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Files%20and%20environment%20variables">Files and environment variables</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<h2 class="chapter">Terminology</h2>

<div class="node">
<p><hr>
Node:&nbsp;<a name="Concept%20Index">Concept Index</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="#Terminology">Terminology</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
<br>
</div>

<h2 class="unnumbered">Concept Index</h2>

<ul class="index-cp" compact>
</ul>


   </body></html>