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
|
<html>
<head>
<link href="../lg.css" rel="stylesheet" type="text/css" media="screen, projection" />
<title>The Answer Gang LG #98</title>
<style type="text/css" media="screen, projection">
<!--
.articlecontent {
position:absolute;
top:143px;
}
-->
</style>
</head>
<body>
<img src="../gx/2003/newlogo-blank-200-gold2.jpg" id="logo" alt="Linux Gazette"/>
<p id="fun">...making Linux just a little more fun!</p>
<div class="content articlecontent">
<div id="previousnexttop">
<A HREF="lg_tips.html" ><-- prev</A> | <A HREF="lg_bytes.html" >next --></A>
</div>
<h1>The Answer Gang</h1>
<p>
<H3>Contents:</H3>
<dl>
<dt><a href="#tag/greeting"
><strong>¶: Greetings From Heather Stern</strong></A></dl>
<DL>
<!-- index_text begins -->
<dt><A HREF="#tag.1"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Apache LAN woes.</strong></a>
<dt><A HREF="#tag.2"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>Preventing Shutdown if NFS Shares Are Open</strong></a>
<dt><A HREF="#tag.3"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>SSH tunneling</strong></a>
<dt><A HREF="#tag.4"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>about windows and linux...</strong></a>
<dt><A HREF="#tag.5"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>checking hard-disk in debian</strong></a>
<dt><A HREF="#tag.6"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>question about env vars</strong></a>
<dt><A HREF="#tag.7"
><img src="../gx/dennis/qbub.gif" height="28" width="50"
alt="(?)" border="0"
><strong>temporary environment changes</strong></a>
<!-- index_text ends -->
</DL>
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag/greeting"><HR WIDTH="75%" ALIGN="center"></A>
<H3 align="left"><img src="../gx/dennis/hbubble.gif"
height="50" width="60" alt="(¶) " border="0"
>Greetings from Heather Stern</H3>
<!-- begin hgreeting -->
<p>
Greetings, gentle readers -- welcome to a new year here at Linux
Gazette.
</p>
</p><p>
Congrats on finding the world of the Linux Gazette Answer Gang. If you
never felt lost finding it this last month or three, thank you - ever
so much! - for your perseverence.
</p><p>
For those among the Answer Gang whose names were lost when we couldn't
retrieve the old list - Glad to have you back! The signup list is at:
<br><a href="http://linuxgazette.net/mailman/listinfo/tag"
>http://linuxgazette.net/mailman/listinfo/tag</a>
</p><p>
If you're new to this magazine, welcome doubled. Have some hot
chocolate and a few software packages. Pull up a chair. Hang out
and share.
</p><p>
To catch everyone up to speed, the Peeve Of The Month refers to the
most common reason, statistically, the querents did not get answered or
didn't like the answer they got... expressed as whatever peeve of ours
they crossed so's to make them lose their TAG lotto ticket.
</p><p>
It in so sense has much to do withas much to do with the toasty crispness
we bring our marshmallows to while roasting our querent's ability to
form a good question when OF COURSE
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
they dunno the answer already...
</p><p>
At the moment, "statistically not getting an answer" and "peeving the
gang" get different results. Statistically the biggest reason for not
seeing your answer last month might be if you were still looking at the
other site. Just to make it clear, if you like the style of the other
site, visit both of us. Plenty of Linux to go around. But I suspect
you'l find us... <em>ahem</em> a little more fun.
</p><p>
Statistically this month the reason went back to simply not providing
enough information for us to figure out what your question was. With
"not linux" being a close second. Honorable mention for the company who
wants us to take over their "answering service" ... errr, we don't do
general phones, linux based PBX or not.
</p><p>
For those whose question made their way to us - and it isn't as bad as
we feared folks, we got 460 mails in November, and a little less this
time but Christmas time is always light.
</p><p>
Now, I must apologize, Most of this is the Blurb I wanted you folks to
read in December -- and I daresay the condition hasn't changed much.
But I will top off with thoughts for the New Year, as well. (For why we
missed December, please see the Mailbag.)
</p><p>
Now, we've got a new thing to
annoy the heck out of us - after we start answering -
people changing the subject line when the
topic hasn't changed! One fellow not only did this almost every single
message, but also was replying singly rather than to the group. We
can't gang up on problems like that. No single one of us - even the
grizzled among us - are experts at everything. (You want proof? see
the SSH thread, and some of the Tips this month.) If you don't like the
topic you picked at first, tell us inside the message. That's why we
have an editorial staff, so we can do stuff like that to the message and
make it easy to read. But make it easier for the folks who *have*
decided to help to stay on your thread. *sigh*
</p><p>
Chanukah and Christmas both passed by and I've <em>still</em> mostly no
idea what to get my geek friends that apt-get isn't already halfway
to downloading. (Or <a href="http://www.urpmi.org/">urpmi</a>,
if they're Mandrake
fans. Thanks to one of the Gang for that tip.) They buy parts for
their computers faster than I do, anyway. Maybe they'd like some nice
parchment editions of the GNU, artistic, perl, MIT, and a few other
licenses to hang on their wall. Jim's mom found a great present though
- a polo shirt with <b>#!</b> as its logo. Not only that, but I think
that ThinkGeek has stopped offering them...
</p><p>
There's one they'll want to steer well clear of, except of course for
the ones who love talking politics and law (and perhaps other things one
doesn't wish to watch being made). But, if you want a good laugh -
a good chuckling belly laugh - and maybe some better understanding of
what's going on in the SCO case, you have got to read the Groklaw site.
I laughed out loud just reading the "Why Groklaw" interview; who
couldn't laugh at "SCO Falls Downstairs, Hitting Its Head on
Every Stair" even just as a title. This is from someone who just has a
lawyer friend with a blog; she claims no special talent in law, sysadmin
tasks, nor coding. Just "the person in the small law firm who knows
enough about computers" to get by. I know you won't believe me, but
we all had to start somewhere. Hanging out with lawyers gives he an ear for
hoping to translate it... and I agree with her - the hunger
to actually undertand what the heck is going on with all these court
cases is real. Specific to SCO, these threads are good too. Better yet
they're not all silly, tho one of these is:
<a href="http://www.groklaw.net/article.php?story=20031119041719640"
>http://www.groklaw.net/article.php?story=20031119041719640</a>
<a href="http://www.groklaw.net/article.php?story=20031106164630915"
>http://www.groklaw.net/article.php?story=20031106164630915</a>
</p><p>
And then there's what Netcraft had to say about it. Make sure your ribs
are all in good order first - they're gonna ache from laughter - and set
your mind to 7 bit ascii:
<br><a
href="http://news.netcraft.com/archives/2003/08/23/your_urgent_assistance_required.html"
>http://news.netcraft.com/archives/2003/08/23/your_urgent_assistance_required.html</a>
</p><p>
For balance, here are some more serious points to consider. I'm sure in
the case of the GNU philosophy [http://www.gnu.org/philosophy/] we're
singing to the choir, but once curious, may as well sate your thirst:
<br><a
href="http://www.osdl.org/newsroom/articles/osdl-second-statement.html"
>http://www.osdl.org/newsroom/articles/osdl-second-statement.html</a>
<br><a href="http://www.gnu.org/philosophy/sco/"
>http://www.gnu.org/philosophy/sco/</a>
</p><p>
These do have pointers to other sites as well.
</p><p>
Ahhhh... philosophy. My December was a rather rocky time, full of both
glad things and sad things, troubles and hope. So I think my lesson for
the new year is about choices.
</p><p>
You have to make your own.
</p><p>
In the sense of Linux, there really are a great many. For at least a
couple of years there have been more varieties than you can shake a
stick at. And you know what? They're getting pretty good.
</p><p>
So before you go picking out a distribution, don't just look at what
your geeky pal tells you is the best. Certainly he or she has spent
some time discovering that for themself. Your needs, however - may
vary. Maybe you write all your friends who don't have computers - then
printing and its troubles will be important to you, maybe scanning too
so they can see the silly things your cat is up to. Need to boot from
almost anywhere but don't need much of a console? Maybe cramming a tiny
distribution on one of those USB thumb drives would be the thing. Or
whatever. Don't want to figure out all these scary things, just wanna
surf? Well heck. Try Knoppix.
</p><p>
As a last note - the
holiday season's a crazy time (at least here it is). Drive safe. Pay
attention to people around you and what you're doing. If it's a time
to be thinking of peace, think how best to keep that peace - and if the
bricks fly, to defend it in a way still consistent with your own ethics.
</p><p>
Happy yuletide.
</p>
<!-- end hgreeting -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag.1"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 1 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Apache LAN woes.</H3>
<p><strong>From Dave Hope
</strong></p>
<p></strong></p>
<p align="right"><strong>Answered By: Jason Creighton, Benjamin Okopnik
</strong></p>
<P><STRONG>
Hello all,
</STRONG></P>
<P><STRONG>
Well, here goes, strange, I feel shy writing an e-mail, I suppose there's a
first for everything... Anyway, I have a VERY basic LAN setup at home, so
basic I should be ashamed to call it one.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jason]
Hey, that's why it's called a Local Area Network: It's local! If you
have at least 2 computers talking to each other, you've got a LAN.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Anyway I decided it was finally
time to remove <A HREF="http://www.apache.org/">Apache</A> from my desktop machine (which connects to the net) and
put it on an old 500MHz machine of mine (Told you my LAN was small).
Everything was, and to a certain degree, still is running fine. However, I
decided it high time I made this webserver of mine accessable to the world.
At the time, I thought it'd be a trivial task, how wrong I was.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jason]
Why did you do this? Not that there's anything wrong with it or
anything, but if your desktop machine can handle the traffic without
causing problems, I don't see any reason why you couldn't run your web
server on it. But....
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Anyway, after asking on experts-exchange.com for some help with my iptables
configuration and badgering various people in #hants on irc.blitzed.org I
eventually got traffic forwarded to my webserver. However, when accessing the
webserver from, not surprisingly the web, I get a lovely 403 (See Error
Message
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">.
I've just set LogLevel to overkill (more commonly known as Debug
<IMG SRC="../gx/dennis/smily.gif" ALT=":D"
height="24" width="20" align="middle"> -- Thanks for the suggestion, Heather.) in Apache and have what seems to
be useful information (See Access_Log: and Error_Log
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">. But, alas, I have no
idea where to go from here, any advice would be more than welcome. (For
information on my LAN and general other stuff, see Info
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</STRONG></P>
<pre><strong>Info:
Server Distro: RedHat9
Desktop Distro: RedHat9
Apache Version: 2.0.40
Diagram: (Yes, it IS that basic).
[Internet]--[Desktop]--[Server]
Error Message:
Forbidden
You were denied access because:
Access denied by access control list.
</strong></pre>
<pre><strong>Access_log:
192.168.1.2 - - [26/Nov/2003:17:26:08 +0000] "GET / HTTP/1.1" 200 2336
192.168.1.2 - - [26/Nov/2003:17:26:08 +0000] "GET / HTTP/1.1" 200 2336
192.168.1.2 - - [26/Nov/2003:17:26:08 +0000] "GET /favicon.ico HTTP/1.1" 404
1009
</strong></pre>
<pre><strong>Error_log:
[Wed Nov 26 17:26:08 2003] [error] [client 192.168.1.2] File does not exist:
/var/www/Default/htdocs/favicon.ico
[Wed Nov 26 17:26:08 2003] [error] [client 192.168.1.2] Syntax error in type
map, no ':' in /var/www/error/contact.html.var for header
error/http_bad_gateway.html.var
[Wed Nov 26 17:26:08 2003] [error] [client 192.168.1.2] unable to include
"../contact.html.var" in parsed file /var/www/error/include/bottom.html
</strong></pre>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Well, I'm now in an even worse situation. Having just moved from RedHat abck
to <A HREF="http://www.suse.com/">SuSE</A>, I cant get as far as I was before. I'm nbow using the following
lines:
</STRONG></P>
<pre><strong>iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to
192.168.1.1
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 443 -j DNAT --to
192.168.1.1
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -d 192.168.1.1 -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
</strong></pre>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Now, when I try to access apache from my ppp0 ip, I don't get through, it
</STRONG></P>
<P><STRONG>
just doesn't seem to connect. Any clues as to why? (Ohh, and
<TT>/proc/sys/net/ipv4/ip_forward</TT> is 1).
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
None, AFAIK; that would be why it's not happening. Here's me forwarding,
both in and out (-s for source, -d for destination) for my iPaq:
</blockQuote>
<blockquote><pre>...
# Flush iptables
iptables -F
# Masquerade any packets that go our from the specified address
iptables -t nat -I POSTROUTING -j MASQUERADE -s 192.168.0.202/32
# Forward any packets _for_ 202
iptables -I FORWARD -s 192.168.0.202/32 -j ACCEPT
# Forward any packets _from_ 202
iptables -I FORWARD -d 192.168.0.202/32 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
</pre></blockquote>
<!-- end 1 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag.2"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 2 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>Preventing Shutdown if NFS Shares Are Open</H3>
<p><strong>From edal
</strong></p>
<p></strong></p>
<p align="right"><strong>Answered By: Thomas Adam, Jim Dennis
</strong></p>
<font color="#000066"><blockquote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] This thread followed us across the move from SSC, parts of it were on
both editions of the answer gang's mailing list...
</blockquote></font>
<P><STRONG>
Hi there
</STRONG></P>
<P><STRONG>
Does anyone have any ideas ? Answers to <A HREF="mailto:edal@NOSPAM.freestart.hu"
>edal@NOSPAM.freestart.hu</A> please, remove NOSPAM for the address to work.
</STRONG></P>
<P><STRONG>
Thanks.
</STRONG></P>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I run a couple of machines at home, both setup with Fedora, a laptop and
a server which also doubles as a second desktop machine. The laptop
accesses a home directory on the server using an NFS share and the
'mount' command. All of this works just fine apart from one problem.
When the server is shut down and I have an open NFS share on the server
my <A HREF="http://www.kde.org/">KDE</A> desktop hangs.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
Yep -- I can see how this might be. I run NFS on my LAN at home, and
although I do not have the same problem as you (fvwm), I suspect the
reason why KDE hangs is because "konqueror" is an integrated (highly
integrated) part of KDE. It is not just a file/web manager, it is also the
backbone. If <EM>that</EM> hangs, you've had it.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I've done some playing around with the <TT>/etc/shutdown.allow</TT> file but all
this does is list the people who are allowed to turn the server off.
What I'm looking for is a way to prevent a server shutdown if someone
else is using an NFS share on the machine.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
Hmm, you'd have to do the check <EM>before</EM> the "unmount -a" command is run
on init 0. There is a file present in all Linux distro's called
"<TT>/etc/halt.local</TT>" which gets run on init 0. The trick here though is to
know the order in which it is run. Obviously, it'll be no good if it gets
called before the "unmount -a" option. Luckily for you though -- it
doesn't.
</blockQuote>
<blockQuote>
So, the steps you might do here is thus:
</blockQuote>
<blockquote><pre># touch /etc/halt.local
# vi /etc/halt.local
</pre></blockquote>
<blockQuote>
Add the following...
</blockQuote>
<blockquote><pre>#!/bin/sh
#halt.local -- ought to get read at init 0
MY_DIR=/dir/that/is/mounted/over/nfs/
[ $(mount | awk '/name_of_dir/ {print $5}') = "nfs" ] &&
{
/sbin/shutdown -c
}
</pre></blockquote>
<blockQuote>
save the file.
</blockQuote>
<blockQuote>
But of course, if I had read your question, I'd have realised that
actually, what you ought to have is something like this in your ~/.profile
file (ignore everything previously -- I'm leaving it in for historical
purposes):
</blockQuote>
<p align="center">See attached <tt><a href="misc/tag/thomas.clientside_haltme.bash_profile.txt">thomas.clientside_haltme.bash_profile.txt</a></tt></p>
<blockQuote>
Then run:
</blockQuote>
<blockquote><pre>source ~/.profile
</pre></blockquote>
<blockQuote>
and try running:
</blockQuote>
<blockquote><pre>haltme 0
</pre></blockquote>
<blockQuote>
Not tested it -- ought to work though.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Perhaps it is my limited knowledge of English (I thought that posting in Hu
ngarian would be a problem) but I do not think I got the question across co
rrectly.
</STRONG></P>
<P><STRONG>
I do not want to do anything with the NFS client, I want the NFS SERVER to
cease a shutdown if one of its NFS shares is in use. Is this what your file
does ?
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
No, it negates it the otherway around, and says that if the client NFS is
mounted then do not shutdown the NFS client. Shrug -- OK, so we negate the
problem onto the NFS server... This will be a little more trickier to do.
I suppose you could utilise the <TT>/etc/exports</TT> file but even then, you'd
have to have a way of testing it.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [JimD]
This symptom is the classic result of NFS hard mounts and without the
"interruptable" option; which are the defaults under Linux.
</blockQuote>
<blockQuote>
Change the NFS line(s) in the <TT>/etc/fstab</TT> to list "intr" in the options
field. Something like:
</blockQuote>
<blockquote><pre>fserver:/usr/share /mnt/nfs/fserver auto intr,ro 0 0
</pre></blockquote>
<blockQuote>
Feel free to read the fstab man page for details about what these
fields mean; and the mount man page, particularly the section on NFS
options.
</blockQuote>
<blockQuote>
Making it "interruptable" will allow process that attempt to access
this export (share) to be killed. By default such processes will
simply be blocked until the NFS share becomes available.
</blockQuote>
<blockQuote>
You could make it a "soft" mount --- which would be that the attempts
to access such directories or files would eventually timeout. However,
"soft" mounts are generally considered to be a bad idea. Most programs
will abort and exit on some timeouts; however, some will just exhibit
odd, unpredictable, behaviors on file/directory access timeouts.
</blockQuote>
<blockQuote>
When you mount filesystems you should make it a practice to unmount
them when not in use and especially when shutting the NFS server down
or disconnecting that machine from that network (in the case of
laptops).
</blockQuote>
<blockQuote>
Keep in mind that NFS was not designed to support laptops, mobile use,
and "occasional use" filesharing. It's built around a set of
reliability assumptions and intended semantics that are not suited to
situations where your fileserver might not be up or might be
inaccessible. It's not suited to "browsers" and interactive file
manager use where attempts to access a directory can result in a "soft"
error.
</blockQuote>
<blockQuote>
NFS systems try to open a file or access a directory and they continue
trying FOREVER until they are interrupted (if the intr option is
enabled), the system is restarted or the server becomes available.
</blockQuote>
<blockQuote>
I've heard of an old case where a pair of UNIX systems were connected
over NFS, where an unattended job was running on the NFS client while
it's server was down. The server was replaced! The data was restored
to the new server and, when it was brought up on the net the client's
process' woke up and completed their job. (That was a month after the
job started --- it just slept in the interim). I have personally had
an NFS server fail, hard drives fail, brought it down, replaced the
drives, restored from backups, and seen the clients just continue
working on the newly restored system unaware of the change.
</blockQuote>
<blockQuote>
It's a different set of reliability semantics that harkens back to a
batch processing computing model.
</blockQuote>
<blockQuote>
Eventually some form of AFS, Coda, Intermezzo or some other newer
filesharing protocol (perhaps even NFSv4) may be more appropriate to
your needs. For now, just add the intr option to your fstab and
understand that processes that access those portions of the tree will
block forever unless they implement their own non-blocking and timeout
semantics.
</blockQuote>
<!-- end 2 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag.3"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 3 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>SSH tunneling</H3>
<p><strong>From Ben Okopnik
</strong></p>
<p></strong></p>
<blockquote><em><font color="#000066">Ah... Ben. You just <EM>know</EM> it has to be juicy good stuff if
it stumps one of the core Answer Gang like this. Enjoy!
-- Heather</font></em></blockquote>
<p align="right"><strong>Answered By: Karl-Heinz Herrmann, Rick Moen, Robos, Heather Stern
</strong></p>
<P><STRONG>
Hi, all -
</STRONG></P>
<P><STRONG>
This week, I'm teaching at a facility in Baltimore where the admin has decided
that a non-transparent proxy is The Flavor Of The Week. This, needless to say,
is a Huge Pain. I have to define/undefine HTTP_PROXY and FTP_PROXY - and their
lowercase equivalents - and log out and back in when I'm there, and reverse the
process when I'm back in my hotel. Oh yeah, gotta do the proxy settings in
Mozilla, too. Oh, and if I want to use Netscape to test something... Yecch.
</STRONG></P>
<P><STRONG>
<Ron Popeil mode>"But there's more!"</RPm> In order to do anything useful with
files at LG, I have to tweak them locally, then upload them to the border router
(Monsieur Admin saw fit, after much conversation, to give me SSH access to it),
then shove them up to LG from there. This is annoying, to say the least.
</STRONG></P>
<P><STRONG>
So, my question is this: would it be possible for me to set up some sort of an
SSH tunnel from my 'top through that border router? I saw something about
tunneling in the MindTerm dialogs (I'm not really even sure why I'm playing with
MT, except that I was curious about it
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">, but couldn't figure it out since I
don't understand the basics behind the concept.
</STRONG></P>
<P><STRONG>
I've got "authorized_keys" on the router (which uses port 1022 - hey, might as
well make it <EM>interesting</EM>, right?); I can download whatever software I need via
HTTP or FTP. No "rsync", no SMTP, no POP, and no direct SSH access, though.
<IMG SRC="../gx/dennis/unsmily.gif" ALT=":("
height="24" width="20" align="middle">
</STRONG></P>
<P><STRONG>
Any advice?
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
So you've ssh access on the router? then you can tunnel whatever you
want, basically. In howfar things are getting more convenient is
something else. Still you've the different setups inside and hotel.
</blockQuote>
<blockQuote>
Let's start with improving mail access
<IMG SRC="../gx/dennis/smily.gif" ALT=":-)"
height="24" width="20" align="middle">
</blockQuote>
<blockQuote><CODE>
from my ~/.ssh/config
</CODE></blockQuote>
<font color="#000066"><blockquote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather] With some tweaking to sanitize hostnames and make the examples
consistent.
</blockquote></font>
<p align="center">See attached <tt><a href="misc/tag/kh-ssh_config.txt">kh-ssh_config.txt</a></tt></p>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
One major drawback with ssh tunneling is:
</blockQuote>
<blockQuote><BLOCKQuote>
You want to tunnel arbitrary connections like a http proxy, but for
every target you have to setup a forwarded port as the information where
you want to go is lost in the tunnel. Another problem might be that you
<EM>need</EM> a target from where you can access everything you want. Having a
proxy on that other end helps a lot for http and ftp.
</BLOCKQuote></blockQuote>
<blockQuote>
Theres seem to be very recent ssh versions which can improve this
situation, but I'm not quite sure how they handle this. My local version
does not have anything in the man-pages. That might have come up on TAG
-- or maybe somewhere else.
</blockQuote>
<blockQuote>
If you want to rsync LG files and this is a defined port you can set up
a forwarding for that too of course.
</blockQuote>
<blockQuote>
forward a gateway port 9999 to target:rsyncport
connect to gateway 9999 and tunnel to target:rsyncport
</blockQuote>
<blockQuote>
ftp passive should work too -- but http and ftp work via proxy anyway.
ssh to a small set of targets is possbible via a set of forward rools,
one each target. something like:
</blockQuote>
<blockquote><pre>alias "ssh_target1"="ssh gateway:target1port"
</pre></blockquote>
<blockQuote>
might make it even convenient.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
OK... I'm missing something. I'm not sure if I've got this right, but here's
a part of my ~/.ssh/config:
</STRONG></P>
<p align="center">See attached <tt><a href="misc/tag/ben_ssh_config.txt">ben_ssh_config.txt</a></tt></p>
<P><STRONG>
I tried the above - "ssh -p 8022 10.3.99.1" - and got "Connection refused".
<IMG SRC="../gx/dennis/unsmily.gif" ALT=":("
height="24" width="20" align="middle">(( This <EM>is</EM> for the local machine (the laptop), right?
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
All these hosts and ports are somewhat confusing. Or you might miss the
"GatewayPorts yes" in the config.
</blockQuote>
<blockQuote>
You've two possibilities I think:
</blockQuote>
<blockQuote><ul>
<!-- * You ssh from lap to gateway and activate port-forwarding rules. This -->
<LI>You ssh from lap to gateway and activate port-forwarding rules. This
<!-- will only make generic access possible, transfer from gateway to -->
will only make generic access possible, transfer from gateway to
<!-- target is unencrypted. -->
target is unencrypted.
<!-- -->
<!-- * Or you ssh to gateway and run an ssh there to the target doing the -->
<LI>Or you ssh to gateway and run an ssh there to the target doing the
<!-- port forwarding. You point your laptop to gateway:FW_ports for the -->
port forwarding. You point your laptop to gateway:FW_ports for the
<!-- connections (requires GatewayPorts yes). -->
connections (requires GatewayPorts yes).
</ul></blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Ah-ha. OK, this is starting to make sense - among all the permissions
stuff, etc. I <EM>think</EM> that what you're saying is this:
</STRONG></P>
<p><Strong><ol>
<LI>On the gateway, bind a listener to an unprivileged port and forward
<LI>From the local host, connect to the forwarded port on the gateway
</ol></Strong></p>
<P><STRONG>
Man, that sounds <EM>too</EM> simple.
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K-.H]
</blockQuote>
<blockQuote>
I explain the first in more details, I think, as this should be enough
for e.g. mail access.
</blockQuote>
<blockQuote>
shell one
</blockQuote>
<blockquote><pre>khh > ssh -f -N -L 8099:mod001.example.com:25 mod017@mod021.example.com
</pre></blockquote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
This is being issued on the gateway, right? I understand the
"port:host:port" syntax: 8099 is mod01:8099, which is being forwarded to
mod021:25 (the remote machine).
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
</blockQuote>
<blockQuote>
shell two
</blockQuote>
<blockquote><pre>khh > telnet localhost 8099
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mod001.example.com
Sendmail 5.65v4.0 (1.1.3.9/23Jul93-0336PM) Tue, 9 Dec 2003 21:51:33
+0100
</pre></blockquote>
<blockQuote>
shell one reacted to the connection:
</blockQuote>
<blockquote><pre>The following connections are open:
#3 direct-tcpip: listening port 8099 for mod001.example.com
port 25, connect from ::1 port 33813 (t4 r2 i0/0 o0/0 fd 12/12)
</pre></blockquote>
<blockQuote>
mind the localhost as other interfaces are not "local".
</blockQuote>
<blockquote><pre>khh > telnet khhlap 8099 ## khhlap is me too
Trying 192.168.2.3...
telnet: connect to address 192.168.2.3: Connection refused
</pre></blockquote>
<blockQuote>
What you do now is run one ssh from the lap to the gateway
</blockQuote>
<blockQuote><ul>
<!-- - does it connect? -->
<LI>does it connect?
<!-- - what does "-v" tell you about forwarded ports -->
<LI>what does "-v" tell you about forwarded ports
<!-- - finally on the lap what does: -->
<LI>finally on the lap what does:
</ul></blockQuote>
<blockquote><pre>telnet localhost 8025
</pre></blockquote>
<blockQuote>
do ?
</blockQuote>
<blockQuote>
point fetchmail (or MUA directly) to localhost port 8995 and you should
be able to read mail instead of working
<IMG SRC="../gx/dennis/smily.gif" ALT=";-)"
height="24" width="20" align="middle">
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Rick]
I'm tempted to suggest proxytunnel, corkscrew, or httptunnel, as
mentioned in <A HREF="http://linuxmafia.com/~rick/linux-info/firewall-piercing"
>http://linuxmafia.com/~rick/linux-info/firewall-piercing</A> .
</blockQuote>
<blockQuote>
<A HREF="http://proxytunnel.sourceforge.net"
>http://proxytunnel.sourceforge.net</A>
<A HREF="http://www.agroman.net/corkscrew"
>http://www.agroman.net/corkscrew</A>
<A HREF="http://www.nocrew.org/software/httptunnel.html"
>http://www.nocrew.org/software/httptunnel.html</A>
</blockQuote>
<blockQuote>
Get in touch with your inner BOFH, Ben.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I actually ran across "corkscrew" on a <A HREF="http://www.debian.org/">Debian</A> list; however, its description
(from "apt-cache show corkscrew") sounds exactly like the Perl script that
Frodo sent in, requiring HTTPS and support for the "CONNECT" method. I
hadn't run across either of the "*tunnel"s, and will check them out if
Karl-Heinz' method (which sounds like it <em> _should</em> work!) doesn't pan out.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Robos]
OK, I <EM>still</EM> have very little clue about networking, but here in my
appartment my flat-pal set up a vtund (a tun) over which we pass everything
when we go wireless. This is a tunnel over ssh. Ping, dhcp, http, ftp,
everything goes through this. Isn't this what you need? Sorry if I
misunderstood it.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Hum. I just tried this on the laptop - I'm not at work anymore, so I'm a
little restricted in my experiments.
</STRONG></P>
<pre><strong>ben@Fenrir:~$ ssh -fNL 8995:localhost:995 target.example.com
</strong></pre>
<P><STRONG>
It did what I thought it should - backgrounded itself.
</STRONG></P>
<pre><strong>ben@Fenrir:~$ ps ax|grep "[s]sh "
657 ? S 0:00 ssh -fNL 8995:localhost:995 target.example.com
</strong></pre>
<P><STRONG>
Then I tested it -
</STRONG></P>
<pre><strong>ben@Fenrir:~$ mail -sfoo ben@linuxgazette.net
Foo!
Cc:
ben@Fenrir:~$ fetchmail -vvv --ssl -uben -P8995 localhost
Enter password for ben@localhost:
#*******************
ben@Fenrir:~$
</strong></pre>
<P><STRONG>
Wow, cool. That worked. However... I'm still trying to figure out how
it'll work with three machines. Would it be something like this?
</STRONG></P>
<pre><strong># Issued on the gateway
ben@gateway:~$ ssh -fNL 8995:localhost:995 target.example.com
# Issued on the laptop
ben@Fenrir:~$ fetchmail --ssl -uben -P8995 gateway
</strong></pre>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
At least you got a working setup going. The ssh commandsequence I gave
you was a sllightly different concept as the one you tried, that's why
we still do not talk about the same thing.
</blockQuote>
<blockQuote>
I was trying to setup a connection like this:
</blockQuote>
<blockQuote><BLOCKQuote>
lap runs a tunneling ssh to gateway. lap is 10.* so private, gateway is
10.* but should be able to route to outside, or it wouldn't be a
gateway. So if you set up a ssh from lap to gateway
at lap> ssh -L 8995:OUTSIDETARGET:995 gateway
</BLOCKQuote></blockQuote>
<blockQuote>
you should then be able to connect to:
at
</blockQuote>
<blockquote><pre>lap> telnet localhost 8995
</pre></blockquote>
<blockQuote>
and reach OUTSIDETARGET 995
</blockQuote>
<blockQuote><ul>
<!-- - GatewayPorts yes not required as long as you connect via localhost -->
<LI>GatewayPorts yes not required as long as you connect via localhost
<!-- interface (at least I got refused when changing localhost to lap -->
interface (at least I got refused when changing localhost to lap
<!-- - connection from gateway to TARGET is unencrypted like the regular -->
<LI>connection from gateway to TARGET is unencrypted like the regular
<!-- transmission would be (i.e. pop3/ssl has its ssl protection but not -->
transmission would be (i.e. pop3/ssl has its ssl protection but not
<!-- the ssh protection) -->
the ssh protection)
</ul></blockQuote>
<blockQuote>
The other version is, as I tried to explain earlier (and what you tried
successfully now):
</blockQuote>
<blockQuote><BLOCKQuote>
You run the tunneling ssh from gateway to some place, OUTSIDETARGET
</BLOCKQuote></blockQuote>
<blockquote><pre>at gateway> ssh -L 8995:OneMoreTARGET:995 OUTSIDETARGET
</pre></blockquote>
<blockQuote><ul>
<!-- - OneMoreTARGET and OUTSIDETARGET may be the same -->
<LI>OneMoreTARGET and OUTSIDETARGET may be the same
<!-- - if the same, OneMoreTARGET might be replaced by localhost -->
<LI>if the same, OneMoreTARGET might be replaced by localhost
</ul></blockQuote>
<blockQuote>
You then can connect from lap to gateway 8995 and reach the
OneMoreTarget 995
</blockQuote>
<blockQuote>
THIS needs GatewayPorts yes as you connect to the forwarded port on
gateway from the lap, i.e. non local
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
OK, I can do that (after disabling the forwarding in .ssh/config -
otherwise I get "bind - Address already in use"):
</STRONG></P>
<pre><strong>on laptop> ssh -p 1022 -L 8995:target.example.com:995 10.3.99.1
</strong></pre>
<pre><strong>on laptop> fetchmail -P 8995 -u ben --ssl localhost
Enter password for ben@localhost:
</strong></pre>
<P><STRONG>
Rats. It didn't work.
</STRONG></P>
<font color="red"><blockquote><em>Heh, "It didn't work". Might I suggest, gentle querent that you looky
here:
</em></blockquote></font>
<font color="red"><blockquote><em><A HREF="http://linuxgazette.net/tag/ask-the-gang.html"
>http://linuxgazette.net/tag/ask-the-gang.html</A>
</em></blockquote></font>
<font color="red"><blockquote><em>That might help you with that phrase
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle">
-- Thomas Adam</em></blockquote></font>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I've been playing around with this forwarding thing all day, on and off (this
course is a bit light on lecture and heavy on student exercise), so I've
managed to try everything you folks here suggested. However, one item stands
out: most of the suggestions (except those from Karl-Heinz) point to HTTP-type
tunnels, all of which in turn rely on the HTTPS "CONNECT" method. One of the
authors of "proxytunnel", Muppet, shows a test for it:
</STRONG></P>
<pre><strong>muppet@runabout:/home/muppet $ telnet some-proxy 8080
Trying 136.232.33.11...
Connected to some-proxy.
Escape character is '^]'.
CONNECT www.verisign.com:443 HTTP/1.0
HTTP/1.0 200 Connection established
Proxy-agent: Netscape-Proxy/3.52
// ---> Tunnel and SSL session starts here
^]
telnet> close
Connection closed.
</strong></pre>
<P><STRONG>
My problem seems to be that I never get past the "CONNECT"; it just sits
there. Which pretty much says none of the methods that rely on it are going to
work.
</STRONG></P>
<P><STRONG>
I don't know what I can do at this point, since the admin here seems rather
paranoid about touching the gateway setup... so I guess I'm stuck, unless
someone comes up with another idea.
</STRONG></P>
<P><STRONG>
Thank you for trying, everyone.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
</blockQuote>
<blockQuote>
This is getting more complicated If something on gateway interferes
with ports. On the other hand I got out of the Indian research center
which simply blocked <EM>everything</EM> in and everything but port 80 and 23
(and ftp) out. That required a sshd outside running on port 23. So don't
despair yet... Oh -- but you said they block <EM>everything</EM> and offer
<EM>only</EM> http proxy and ftp proxy.
</blockQuote>
<blockQuote>
I'm not 100% percent convinced it didn't. Ther <EM>was</EM> a connection to
something. If fetchmail obeyed the -P 8995 it was <EM>not</EM> a pop3 running
on laptop at port 8995 by accident. You would know.... for all fetchmail
knows it*is* connected to localhost and you asked for user ben. Of
course you have to supply users/password for target.example.com (secure
pop3 on 995). Might the ssl stuff open other ports as well? Or just an
afterthough while typing a reply below: Does fetchmail ask the passwd
<EM>before</EM> it connects? Then it doesn't show anything of course.
</blockQuote>
<blockQuote>
On the other hand if supplying a password at that point didn't work and
the user is ok.... hmmm....
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
</STRONG></P>
<P><STRONG>
If I try to enable GatewayPorts, I get "bind - Address already in
use", which probably means some odd firewalling going on. The same
thing happens with trying to forward 8022 to 22 on "target.example.com".
Doesn't seem like this method is going to work.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
</blockQuote>
<blockQuote>
Hm. You tried to switch on GatewayPorts where? For the above setup it
would only make sense on Laptop (Fenrir) -- GatewayPorts allows
non-local connections to the <EM>local</EM> forwarded port (i.e. the first
number after -L to ssh).
</blockQuote>
<blockQuote>
Hmm... at this point lets assume they messed up the gateway so either
the gateway sshd is not allowed to forward anything or or they just dump
packets from inside which are not for the two proxy ports.
</blockQuote>
<blockquote><pre>> at gateway> ssh -L 8995:localhost:995 target.example.com
</pre></blockquote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
again looks ok
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
</STRONG></P>
<pre><strong>at laptop> fetchmail -P 8995 -u ben --ssl 10.3.99.1
Enter password for ben@10.3.99.1:
</strong></pre>
<P><STRONG>
In the log file:
</STRONG></P>
<pre><strong>Dec 10 11:05:50 Fenrir fetchmail[2716]: POP3 connection to 10.3.99.1
failed: Connection refused
Dec 10 11:05:50 Fenrir fetchmail[2716]: Query status=2 (SOCKET)
</strong></pre>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K-H.]
Hm.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
I've also tried it as
</STRONG></P>
<pre><strong>at gateway> ssh -L 8995:target.example.com:995 target.example.com
at laptop> fetchmail -P 8995 -u ben --ssl 10.3.99.1
</strong></pre>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
ok. good to make sure.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Same error as above.
</STRONG></P>
<P><STRONG>
Just to test it, in a really simple manner:
</STRONG></P>
<pre><strong>at gateway> telnet target.example.com 25
(works fine)
</strong></pre>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
good. At least you <EM>do</EM> get out.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
</STRONG></P>
<P><STRONG>
at gateway> ssh -L 8025:localhost:25 target.example.com
at laptop> telnet 10.3.99.1 8025
Trying 10.3.99.1...
telnet: Unable to connect to remote host: Connection refused
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
Hm. Might be firewall on gateway dumping/refusing your connection
even if you've a nice open port.
</blockQuote>
<blockQuote>
Well at least I understand the next:
</blockQuote>
<P><STRONG><BLOCKQuote>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
at gateway> ssh -L 8025:10.3.4.100:25 target.example.com # My IP
</BLOCKQuote></STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
if it's on gateway (and only there you can see target.example) you've got
the port on gateway. You are forwarding to a private IP -- whatever that
in context of target.example might be.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Tried it both enabled and disabled (on the gateway machine, that is);
no luck.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
That would be the proper place (gateway).
</blockQuote>
<blockQuote>
I just wanted to admit defeat, but can't you connect from the back form
the gateway to lap with -R? Where is the manpage....
</blockQuote>
<blockQuote>
ok, one last try:
</blockQuote>
<blockQuote><BLOCKQuote>
- you connect (ssh) to gateway
- on gateway run:
ssh -R 8995:target.example.com:995 laptop
</BLOCKQuote></blockQuote>
<blockQuote>
- now on laptop your fetchmail sequence
</blockQuote>
<blockQuote>
- try again with (on gateway)
</blockQuote>
<blockQuote>
ssh -R 8025:target.example.com:25 laptop
on laptop:
telnet localhost 8025
</blockQuote>
<blockQuote>
This is cutting the gateway sshd out of the chain -- but they still
might have non overrideable ssh client configs prohibiting -L entirely.
"-v" to ssh does not give any errors/warnings?
</blockQuote>
<blockQuote>
If that fails too -- I think it's possible to run a ppp line over a
terminal (telnet) connection. I don't know how to setup a pppd over
terminal but I think I know how to setup the terminal tunnel:
</blockQuote>
<blockquote><pre>on lap:
pipe here | ssh -e none gateway ssh -e none target.example.com | pipe here
sprinkle freely with -f -n -N
</pre></blockquote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
I know we have a number of tunneling toys on LNX-BBC; I wonder if it
has something that we haven't mentioned. If not, it would be awful fun
to chase that on down.
</blockQuote>
<blockQuote>
My normal solution is to put an ssh service on a port that people, um,
think means something the firewall says is ok. After that it's all a
pipe... a port's a port.
</blockQuote>
<h4 align="center"><br>Ben then cheerfully reported back the following....
</h4>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Ben]
WOO-HOO! Karl-Heinz, you're The Man!
<IMG SRC="../gx/dennis/smily.gif" ALT=":)"
height="24" width="20" align="middle"> It works fine. I can get my
email... Can't send it yet, though. I've done the following:
</blockQuote>
<blockquote><pre>gateway> ssh -p 22 -R 25:target.example.com:25 root@laptop
</pre></blockquote>
<blockQuote>
which gets me genetikayos:25 sitting at laptop:25... but I still don't
have name resolution on localhost:
</blockQuote>
<blockquote><pre>delivering message 1AUVAe-0002gK-00
LOG: 0 MAIN
== ben@linuxgazette.net R=lookuphost defer (-1): host lookup did not complete
</pre></blockquote>
<blockQuote>
Almost there, though!
</blockQuote>
<blockQuote>
I ran out of time before I had a chance to try that out (I'm sure it
would have worked fine) - this class usually wraps up around 1 or 2pm
Friday, and then I'm out of there and looking for the fastest way home.
However, it looks like I might be teaching there again soon (the
students gave me perfect ratings, and the facility manager was <em>very_</em>
happy), so I'll probably get another shot at it.
</blockQuote>
<blockQuote>
Thanks for all your help - it's been a terrific education in SSH
capabilities!
</blockQuote>
<!-- end 3 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag.4"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 4 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>about windows and linux...</H3>
<p><strong>From Viper9435
</strong></p>
<p></strong></p>
<p align="right"><strong>Answered By: Heather Stern, Thomas Adam, Tom Brown
</strong></p>
<P><STRONG>
Im currently using Xoblite, and do you know how i can make my windows xp look
more like linux?
</STRONG></P>
<font color="red"><blockquote><em>Please, Please, please send your e-mails in plain/text. HTML is evil and
just wraps useless meta-data around the precious text. Both Heather and
I have been mentioning this in past months...don't do it again,
gentle readers.
-- Thomas Adam</em></blockquote></font>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Heather]
</blockQuote>
<blockQuote><ol>
<LI>There are alternative window managers for Windows; you could switch to
<LI>I once saw a package called "enlightenment for Windows" and what it
</ol></blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [TomB]
For the command line part, you shouldn't forget Cygwin. It does a good
job of giving you a Linux CLI, and it's free.
</blockQuote>
<font color="#660000"><blockquote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas] I am going to have to agree here, and also mitigate this question by
asking why would you want to play a game of 'cloak and daggers' with
your windows machine -- dressing it up all you like to try and make it
look like Linux won't change the operational fact that underneath all
the superfluous style remains IMHO, an unstable, unreliable operating
system. If you ask me, if you have to make Windows look like Linux,
don't. Instead, just install Linux and be had with you.
</blockquote></font>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [TomB]
But, if you're looking to change the appearance of XP, there are several
solutions. None are free that I know of. The best is from Stardock, in
their Object Desktop collection of utilities. The whole thing costs
about $50, and has a ton of great stuff in it. Or, you can buy just one
piece of it for about $20: Window Blinds. Window Blinds allows you to
change the entire GUI using "themes". For example, someone wrote a "Blue
Curve" theme that looks exactly like <A HREF="http://www.redhat.com/">Red Hat</A>'s GUI. Someone else has
ported the Blue Curve icons, which you can install using Object
Desktop's Icon Packager. There are utilities that allow you to change
the logon screen -- and again, someone's created a Red Hat logon screen.
Look at some of the screen shots on www.wincustomize.com to see the
themes available before you buy anything. The Object Desktop collection
even includes a tool to design your own Window Blinds theme, if you
don't see anything you like on the web.
</blockQuote>
<font color="#660000"><blockquote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas] There is also now a port of fluxbox to windows. Unfortunately I don't
remember the URL, but this'll give you, the gentle readers, a chance to
re-aquaint yourselves with <A HREF="http://www.google.com/linux"
>http://www.google.com/linux</A>
</blockquote></font>
<!-- end 4 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag.5"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 5 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>checking hard-disk in debian</H3>
<p><strong>From Joydeep Bakshi
</strong></p>
<p></strong></p>
<p align="right"><strong>Answered By: Colin Charles, Thomas Adam
</strong></p>
<P><STRONG>
Hi list,
</STRONG></P>
<P><STRONG>
Here is a typical problem in debian. after particular days my debian show during
booting * <TT>/dev/hda6</TT> mounted 31 times without checking, check forcde* and it
starts fsck.
</STRONG></P>
<P><STRONG>
now my question is that ; has debian programmed to check hard disk after 31
times mounting the disk ? if so how to change this so that it will check hard
disk whenever find a problem like red-hat ?
</STRONG></P>
<P><STRONG>
thanks in advance.
</STRONG></P>
<font color="#660000"><blockquote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas] This is not a 'problem' but a design descision. When you originally
created the partitions during the debian install, debian does tell you
that this feature can be changed via the tune2fs program
</blockquote></font>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Colin]
I find using the option:
</blockQuote>
<blockquote><pre>shutdown -fh now
</pre></blockquote>
<blockQuote>
where the -f switch skips fsck on the next reboot a rather helpful thing
to avoid getting fsck started up at all.
</blockQuote>
<blockQuote>
Yes (but I'm not certain with regards to 31 times, it could be higher).
To make <A HREF="http://www.redhat.com/">Red Hat</A> do the same thing (it does, but after a much higher
mount count), use the tune2fs tool.
</blockQuote>
<font color="#660000"><blockquote><IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas] Perhaps you are confused, Colin? tune2fs will either check the drive
after a certain number of mounts have been had, <EM>or</EM> it will check it
after or uptil a certain date -- whichever one comes first.
</blockquote></font>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
I have mentioned tune2fs countless times over the years, however...
</blockQuote>
<blockquote><pre>tune2fs -c 100 -C 1 /dev/hdxx
</pre></blockquote>
<blockQuote>
where hdxx is your device, will mean that after every 100 successive
mounts, your drive will be checked.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Colin]
If you shutdown incorrectly (instead of issuing shutdown/halt, you hit
the power switch), Red Hat or <A HREF="http://www.debian.org/">Debian</A> will run fsck upon the next reboot
since there could be "problems".
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
This is only due to the fact that mount did not umount the drives
correctly. Again, this can be had with tune2fs. The process by which init
goes through to shut your machine down is usually pretty good. Unless
one is still using ext2, the process is usually quick since if one is
using ext3, the journal will only check the superblock for the last
changes made.
</blockQuote>
<blockQuote>
As an aside, one tip I always give people is that when one is creating
new partitions, for '<TT>/boot</TT>' I make that ext2, since as it is mounted ro
(read-only) it doesn't require a journal.
</blockQuote>
<!-- end 5 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag.6"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 6 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>question about env vars</H3>
<p><strong>From - EJ -
</strong></p>
<p></strong></p>
<p align="right"><strong>Answered By: Thomas Adam, Karl-Heinz Herrmann, Jim Dennis
</strong></p>
<blockquote><em><font color="#000066">Again, this thread has followed us across both "TAG" mailing lists to
the new site. For readers keeping up on both, be advised that very few
if any of the LinuxGazette.Net answer gang hang out on SSC's version of
the list at all anymore; this may be the last month that the older list
sees any answers. Some of the Gang left the old list more because
of spam overload via that source than the changeover <EM>per se</EM> but there
you go. The correct place to reach The Answer Gang now is
<A HREF="mailto:tag@linuxgazette.net"
>tag@linuxgazette.net</A>.
-- Heather</font></em></blockquote>
<P><STRONG>
Could someone please help me setting env vars within a scrpt but will remain with my interactive environment. Please note I am trying to do this with ksh and bash; however, I am not getting success. The env vars set in the script, I can echo them, but they disappear after the script has completed. How can I have the env vars remain after the script is completed similar to .profile?
</STRONG></P>
<P><STRONG>
Thanks in advance.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
You have sent several e-mails to this list before...PLEASE please send in
PLAIN-TEXT only.
</blockQuote>
<blockQuote>
You have to "export" them, like so:
</blockQuote>
<blockquote><pre>export MY_ENV_VAR="my value"
</pre></blockquote>
<blockQuote>
Then when the script exits, you can do:
</blockQuote>
<blockquote><pre>echo $MY_ENV_VAR
</pre></blockquote>
<blockQuote><CODE>
from the CLI, and you will see the value stored therein.
</CODE></blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H]
This might be a problem with subshells.
</blockQuote>
<blockquote><pre>khh > ./test.sh
test
khh > echo $TEST_VAR
</pre></blockquote>
<blockquote><pre>khh > cat test.sh
export TEST_VAR="test"
echo $TEST_VAR
</pre></blockquote>
<blockQuote>
The script runs in its own shell and <EM>CAN NOT</EM> change the environment of
the parent (your shell in which you are typing).
</blockQuote>
<blockQuote>
run the sccript with source:
</blockQuote>
<blockquote><pre>khh > source test.sh
test
khh > echo $TEST_VAR
test
</pre></blockquote>
<blockQuote>
a shortcut often is ".":
</blockQuote>
<blockquote><pre>> . test.sh
test
</pre></blockquote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [JimD]
It can't be done. You are suffering from a fundamental
misunderstanding of how Linux (and UNIX) works.
</blockQuote>
<blockQuote>
Variables set in your shell are part of your process. <EM>Environment</EM>
Variables are set in your shell and moved (exported) to a region of
memory that is preserved through exec*() system calls.
</blockQuote>
<blockQuote>
When you run an external command (binary or shell script) it runs
in a subprocess. You subprocess inherits A COPY its parent's
environment. I can modify that. However, at the end of the process
then the COPY is reclaimed (freed).
</blockQuote>
<blockQuote>
So, if you have a script that set variables for you; you can't execute
it in the normal way. That is to say you can't invoke it as a program.
So you have to "source" it. This is done using the . (dot) command.
</blockQuote>
<blockQuote>
Let me give an example:
</blockQuote>
<blockquote><pre> mysettings.sh
</pre></blockquote>
<blockQuote>
... contains a set of lines like:
</blockQuote>
<blockquote><pre> #!/bin/sh
FOO=bar
BAZ=bang
export FOO BAZ
</pre></blockquote>
<blockQuote>
If you invoke it:
</blockQuote>
<blockquote><pre> ./mysettings.sh
</pre></blockquote>
<blockQuote>
... then your shell runs mysettings.sh in a subprocess; which dutifully
sets those variables and exports them; and then promptly FORGETS them
as it dies (exits). (Right after the end of the script; there's an
implicit exit to the subprocess).
</blockQuote>
<blockQuote>
If you <EM>source</EM> it:
</blockQuote>
<blockquote><pre> . ./mysettings.sh
</pre></blockquote>
<font color="red"><blockquote><em>For those of you playing along at home the "." is a synonym for
'source'
-- Thomas Adam</em></blockquote></font>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [JimD]
... then your shell reads each line of the file and evaluates each
one as if you'd typed it in yourself. Any settings made IN THIS WAY
will persist for the life of that process (your interactive login shell
for this example).
</blockQuote>
<blockQuote>
This is, by far, one of the most confusing and most often misunderstood
facets of shell programming and based UNIX usage.
</blockQuote>
<blockQuote>
Some day I'm going to have Heather create an animated web picture,
and slide show, perhaps even a little "flash" file depicting this
process of variable assignment, export, sub-process creation (fork()ing),
program execution (exec*()ing), process termination (exit()ing),
sub-process exit status harvesting (or reaping, using <TT> wait()</TT>), and
signal handling (SIGCHLD).
</blockQuote>
<blockQuote>
It's a big part of my basic Linux classes.
</blockQuote>
<!-- end 6 -->
<!-- .~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~.~~. -->
<A NAME="tag.7"><HR WIDTH="75%" ALIGN="center"></A>
<!-- begin 7 -->
<H3 align="left"><img src="../gx/dennis/qbubble.gif"
height="50" width="60" alt="(?) " border="0"
>temporary environment changes</H3>
<p><strong>From Ben Okopnik
</strong></p>
<p></strong></p>
<p align="right"><strong>Answered By: Jason Creighton, Thomas Adam, Karl-Heinz Herrmann
</strong></p>
<P><STRONG>
Recently, I spent a week at a client's location which required setting
several environment variables in order to use their proxy server.
Something that made it quite annoying was the necessity of un-setting
these variables when I went back to my hotel room and connected via
dial-up. Setting and unsetting the variables and logging in and out
twice every day did not appeal to me, so I modified my "~/.bashrc" file
by adding the following lines to it while logged in and running X --
</STRONG></P>
<pre><strong># TEMPORARY PROXY DEFS
[ -f ~/PROXY ] && {
export HTTP_PROXY=http://10.3.99.1:8080
export FTP_PROXY=http://10.3.99.1:8080
export http_proxy=http://10.3.99.1:8080
export ftp_proxy=http://10.3.99.1:8080
}
</strong></pre>
<P><STRONG>
I then created a file called "PROXY" in my home directory.
Proceeding from this point was a simple matter: when I needed the above
variables to be unset, I moved "PROXY" to "NOPROXY" (any other name
would do as well, but I wanted it to be an obvious reminder) and closed
all the open xterms. Any xterms I opened from that point on would not
have these variables set. Reversing it was just as obvious - a matter of
renaming the file back to the original name and closing all xterms
again.
</STRONG></P>
<P><STRONG>
Mozilla isn't really amenable to this kind of thing and would have
required manual changes every time, so I just used Dillo and w3m when
away from the office.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jason]
Seems like there should be a way to do this automatically. If there's a
network share at that client's location, you could make PROXY a symlink
to it, thus rendering it broken when you don't have the share mounted,
causing it to fail the existence test.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
Indeed, Jason -- something which I do all the time, i.e.:
</blockQuote>
<blockquote><pre>[ ! -e $(ls -l $HOME | awk '/PROXY/ {print $11}') &&
{
# hmm, you must be joking, right?
exit 1;
} || {
# so it is there, and working, continue with the exports....
...
}
</pre></blockquote>
<blockQuote>
If I was really worried, I might also just prefix a test for PROXY to
make sure that it actually <EM>is</EM> a symbolic link (test -L).
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jason]
Or you could look at the network address of the interface that you're
using (Ethernet? Or some cool wireless dealy?) to see if it matches a
certain pattern. (Presumably the IPs are handed out by DHCP)
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Thomas]
If it were DHCP, I wouldn't bother with this idea, since the IP would
change each time.
</blockQuote>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [Jason]
Or you could just stick with what you've got, but that wouldn't be as
much fun.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Maybe not - but it <em> _would</em> allow me to work at different clients'
locations, with different network shares, IP patterns, etc. - that being
the point of leaving this gadget in place rather than just deleting it
once I was done. ISTR running into this in at least one other client
center... maybe more, but I can't recall.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
There are programs out there which determine the network you are in and
run scripts for you (e.g. link different resolv.conf and hosts in place
and set a proxy).
</blockQuote>
<blockQuote>
One I've used for some time is divine (seems unsupported by now and a
recompile just didn't want to work the last time I tried). Another I've
found but not yet tested is intuitively (intuitively_0.1.5-1.tar.gz).
That would automate the change of the basic network config based on IP's
found in the neighbourhood (divine sends arp requests).
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Wouldn't "divine" require knowing a given network's specifics in the
first place?
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
Yes -- you would have to put a line in the divine.conf with an IP to be
found on the network to identify it. Some other details as well. Once
done it's fully automatic.
</blockQuote>
<P><STRONG>
<IMG SRC="../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
The problem is that I don't, until I get to the specific
site. It seems that the centers where I teach are set up based on the
local sysadmin's preferences. However, I do use a self-modifying script
that "memorizes" the IPs I give it; after running it once in a location,
set up for the rest of the week is a matter of running it and hitting
"Enter" four times. I've just rewritten in in Perl (it used to be a
shell script with Perl one-liners in it...) Note that it does have to be
run as root - or it could be modified to use "sudo".
</STRONG></P>
<p align="center">See attached <tt><a href="misc/tag/memorize-network.perl.txt">memorize-network.perl.txt</a></tt></p>
<P><STRONG>
I'll admit that the experience <em> _is</em> interesting - at this point, I can
fit my laptop into just about any network environment that these folks
have been able to think up, which is a point of pride. Of some sort,
anyway.
</STRONG></P>
<blockQuote>
<IMG SRC="../gx/dennis/bbub.gif" ALT="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
> [K.-H.]
That way of modifying the script itself is interesting. I would have
thought of input files only. I know you get into deep trouble if you
overwrite a shell-script which is running, with perl this should work as
perl is compiled at the beginning.
</blockQuote>
<!-- end 7 -->
</p>
<!-- *** BEGIN author bio *** -->
<P>
<P>
<!-- *** END author bio *** -->
<div id="articlefooter">
<p>
Copyright © 2004, . Copying license
<a href="http://linuxgazette.net/copying.html">http://linuxgazette.net/copying.html</a>
</p>
<p>
Published in Issue 98 of Linux Gazette, January 2004
</p>
</div>
<div id="previousnextbottom">
<A HREF="lg_tips.html" ><-- prev</A> | <A HREF="lg_bytes.html" >next --></A>
</div>
</div>
<div id="navigation">
<a href="../index.html">Home</a>
<a href="../faq/index.html">FAQ</a>
<a href="../lg_index.html">Site Map</a>
<a href="../mirrors.html">Mirrors</a>
<a href="../mirrors.html">Translations</a>
<a href="../search.html">Search</a>
<a href="../archives.html">Archives</a>
<a href="../authors/index.html">Authors</a>
<a href="../contact.html">Contact Us</a>
</div>
<div id="breadcrumbs">
<a href="../index.html">Home</a> >
<a href="index.html">January 2004 (#98)</a> >
Article
</div>
<img src="../gx/2003/sit3-shine.7-2.gif" id="tux" alt="Tux"/>
</body>
</html>
|