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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<META NAME="generator" CONTENT="lgazmail v1.1G.e">
<TITLE>The Answer Guy 36:
'ls' Doesn't work for FTP Site
</TITLE>
</HEAD><BODY BGCOLOR="#FFFFFF" TEXT="#000000"
LINK="#3366FF" VLINK="#A000A0">
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<H4>"The Linux Gazette...<I>making Linux just a little more fun!</I>"</H4>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<center>
<H1><A NAME="answer">
<img src="../../gx/dennis/qbubble.gif" alt="(?)" border="0" align="middle">
<font color="#B03060">The Answer Guy</font>
<img src="../../gx/dennis/bbubble.gif" alt="(!)" border="0" align="middle">
</A></H1>
<BR>
<H4>By James T. Dennis,
<a href="mailto:answerguy@ssc.com">answerguy@ssc.com</a><BR>
Starshine Technical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A>
</H4>
</center>
<p><hr><p>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- begin 6 -->
<H3 align="left"><img src="../../gx/dennis/qbubble.gif" height="50" width="60"
alt="(?) " border="0">
'ls' Doesn't work for FTP Site
</H3>
<p><strong>From Reuel Q. Salamatin on Tue, 01 Dec 1998
</strong></p>
<!-- ::
'ls' Doesn't work for FTP Site
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: -->
<P><STRONG><IMG SRC="../../gx/dennis/qbub.gif" ALT="(?)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Mr. James T. Dennis,
</STRONG></P>
<P><STRONG>
I am so happy to have known that you are available to anwer
Linux questions. I have tried emailing persons I found
from how-to files and documentations about ftp, but as of
yet, got no answers.
</STRONG></P>
<P><STRONG>
Here's my problem. Our ftp site doesn't seem to support the
ls command.
</STRONG></P>
<P><STRONG>
Usually, upon log-in, or with a browser it should display
directory listings. Now it worked just like that before. But now,
it doesn't. I don't actually remember how it came about to be
like that.
</STRONG></P>
<P><STRONG>
I have followed instructions listed on the ftpd man page,
about making a copy of the ls command on the bin directory of
ftp home. I did just that but still no directory listing
output. I was wondering what else could have gone wrong.
</STRONG></P>
<P><STRONG>
Thank you even now in anticipation of your response.
</STRONG></P>
<P><STRONG>
Sincerely yours,
<br>Mr. Roland Reuel Q. Salamatin
</STRONG></P>
<BLOCKQUOTE><IMG SRC="../../gx/dennis/bbub.gif" alt="(!)"
HEIGHT="28" WIDTH="50" BORDER="0"
>
Assuming that you're using one of the traditional FTP
servers (daemons) such as the BSD derived one, or
WU-FTPD (which has been the default on most Linux
distributions for several years), this probably
relates to one of three problems. All have to do
with the 'chroot' jail in which anonymous FTP (and
the "guestgroups" from WU-FTP) operate.
</BLOCKQUOTE>
<BLOCKQUOTE>
The idea here is that we've tried to minimize the risks to
your system that are associated with having untrusted
parties (anonymous and guest FTP users) accessing your
directories. So we set up a psuedo "root" directory and
issue the '<tt>chroot()</tt>' system call to "lock the
process into a directory."
</BLOCKQUOTE>
<BLOCKQUOTE>
On problem with this approach is that most Unix/Linux
programs need access to files like '<TT>/etc/passwd</TT>' and
'<TT>/etc/group</TT>' (to map the numeric ownership codes that are
stored in the inodes of file and directories to the
associated names and groups. Also most modern programs
(dynamically linked ELF binaries) require access to
'<TT>/dev/zero</TT>' (a psuedo-device) for fairly obtuse reasons that
amount to "because that's the way they work."
</BLOCKQUOTE>
<BLOCKQUOTE>
So we need to build a skeletal copy/shadow of the system's
directory structure to support this. That must contain
at least the following files:
</BLOCKQUOTE>
<BLOCKQUOTE>
<ul>
<li>'ls' binary in the [chroot]/usr/bin
<li>Fake 'passwd' and 'group' files for [chroot]/etc
<li>A copy of (or hard link to) <TT>/dev/zero</TT> and <TT>/dev/null</TT>
under [chroot]/dev/
<li>(Possibly) copies of any shared libraries to
which your copy of 'ls' is linked.
</ul>
</BLOCKQUOTE>
<BLOCKQUOTE>
(You can compile a statically linked '<TT>ls</TT>' or you
can use the '<tt>ldd</tt>' command to get a list of
the required shared libraries).
</BLOCKQUOTE>
<BLOCKQUOTE>
Another option is to replace the BSD or WU ftp daemon with
Mike Gleason's '<tt>ncftpd</tt>', or with ProFTPD which both have
built-in static '<tt>ls</tt>' support.
</BLOCKQUOTE>
<BLOCKQUOTE>
'<tt>ncftpd</tt>' is not free. It is shareware and can be registered
for about $200 for a high volume server (more than 50
concurrent users) or ~$40 for a smaller server. Mike
Gleason continues to support and release the best FTP
<EM>client</EM> for free. There is also a free "personal use"
option (upto 3 concurrent users). You can find out more:
</BLOCKQUOTE>
<BLOCKQUOTE> <BLOCKQUOTE> <CODE>
<A HREF="http://www.ncftp.com">http://www.ncftp.com</A>
</CODE> </BLOCKQUOTE> </BLOCKQUOTE>
<BLOCKQUOTE>
Of the FTP daemons that I've tried, '<tt>ncftpd</tt>' was the easiest
to set up and definitely the easiest to configure. It also
supports "virtual FTP hosting" (where one host appears to be
several different FTP servers, each with different directory
structures and separate user lists). My only
complaint was that this server doesn't seem to like being
dynamically loaded from '<tt>inetd</tt>' (unlike the normal ftp
daemons --- but more like '<tt>sendmail</tt>' and most web servers).
</BLOCKQUOTE>
<BLOCKQUOTE>
ProFTPD is under the GPL. I know know the author's name
and it may be a whole team that's worked on it.
</BLOCKQUOTE>
<BLOCKQUOTE> <BLOCKQUOTE> <CODE>
<A HREF="http://www.proftpd.org">http://www.proftpd.org</A>
</CODE> </BLOCKQUOTE> </BLOCKQUOTE>
<BLOCKQUOTE>
I have yet to try this one. However it looks very ambitious
--- and might appeal to <A HREF="http://www.apache.org/">Apache</A>
webmasters in particular. The configuration files and directives are
intentionally set to match or resemble Apache configuration options
wherever possible.
</BLOCKQUOTE>
<BLOCKQUOTE>
From what I've read the original author started working on a
security audit and patch set to WU-FTPD and gave up. He
then wrote the whole thing from scratch.
</BLOCKQUOTE>
<BLOCKQUOTE>
So, I hope that helps. Naturally you could just fuss with
the existing ftp daemon and "get it to work." Alternatively
either of these replacements might be much better for your
needs --- and considerably easier, as well.
</BLOCKQUOTE>
<BLOCKQUOTE>
If not then there are a few other choices:
</BLOCKQUOTE>
<BLOCKQUOTE>
<DL><DT>BeroFTPD:
<DD><tt><A HREF="ftp://ftp.aachen.linux.de/pub/BeroFTPD"
>ftp://ftp.aachen.linux.de/pub/BeroFTPD</A></tt>
<br>This is a WU-FTPD derivative.
<DT>Troll Tech FTP Daemon:
<DD><tt><A HREF="http://www.troll.no/freebies/ftpd.html"
>http://www.troll.no/freebies/ftpd.html</A></tt>
<br>Troll Tech is the publisher of the Qt libraries on which
<A HREF="http://www.kde.org/">KDE</A> is built.
<DT>anonftpd
<DD><tt><A HREF="ftp://koobera.math.uic.edu/www/anonftpd.html"
>ftp://koobera.math.uic.edu/www/anonftpd.html</A></tt>
<br>by D.J Bernstein (author of qmail) --- very
lightweight FTP daemon, purely for read-only
anonymous access. (Doesn't support normal user
or "guest" accounts). Main focus is on security
and low memory footprint.
</dl>
</BLOCKQUOTE>
<BLOCKQUOTE>
... and I'm sure we could find many others.
</BLOCKQUOTE>
<!-- sig -->
<!-- end 6 -->
<!--startcut ======================================================= -->
<P> <hr> <P>
<H5 align="center"><a href="http://www.linuxgazette.com/ssc.copying.html"
>Copyright ©</a> 1999, James T. Dennis
<BR>Published in <I>The Linux Gazette</I> Issue 36 January 1999</H5>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<P align="center">
<table width="98%"><tr valign="center" align="center">
<td rowspan="3" colspan="6"><A HREF="../lg_answer36.html"><IMG
SRC="../../gx/dennis/answernew.gif"
ALT="[ Answer Guy Index ]"></A></td>
<TD><A HREF="./a.html">a</A></TD>
<TD><A HREF="./b.html">b</A></TD>
<TD><A HREF="./c.html">c</A></TD>
<TD><A HREF="./1.html">1</A></TD>
<TD><A HREF="./2.html">2</A></TD>
<TD><A HREF="./3.html">3</A></TD>
<TD><A HREF="./4.html">4</A></TD>
<TD><A HREF="./5.html">5</A></TD>
<TD><A HREF="./6.html">6</A></TD>
<TD><A HREF="./7.html">7</A></TD>
<TD><A HREF="./9.html">9</A></TD>
<TD><A HREF="./10.html">10</A></TD>
<TD><A HREF="./11.html">11</A></TD>
<TD><A HREF="./12.html">12</A></TD>
</tr><tr valign="center" align="center">
<TD><A HREF="./15.html">15</A></TD>
<TD><A HREF="./16.html">16</A></TD>
<TD><A HREF="./18.html">18</A></TD>
<TD><A HREF="./19.html">19</A></TD>
<TD><A HREF="./20.html">20</A></TD>
<TD><A HREF="./21.html">21</A></TD>
<TD><A HREF="./22.html">22</A></TD>
<TD><A HREF="./23.html">23</A></TD>
<TD><A HREF="./24.html">24</A></TD>
<TD><A HREF="./25.html">25</A></TD>
<TD><A HREF="./26.html">26</A></TD>
<TD><A HREF="./27.html">27</A></TD>
<TD><A HREF="./28.html">28</A></TD>
</tr><tr valign="center" align="center">
<TD><A HREF="./29.html">29</A></TD>
<TD><A HREF="./31.html">31</A></TD>
<TD><A HREF="./32.html">32</A></TD>
<TD><A HREF="./33.html">33</A></TD>
<TD><A HREF="./34.html">34</A></TD>
<TD><A HREF="./35.html">35</A></TD>
<TD><A HREF="./36.html">36</A></TD>
<TD><A HREF="./37.html">37</A></TD>
<TD><A HREF="./38.html">38</A></TD>
<TD><A HREF="./39.html">39</A></TD>
<TD><A HREF="./40.html">40</A></TD>
<TD><A HREF="./41.html">41</A></TD>
<TD><A HREF="./42.html">42</A></TD>
<TD><A HREF="./44.html">44</A></TD>
</tr><tr valign="center" align="center">
<TD><A HREF="./45.html">45</A></TD>
<TD><A HREF="./46.html">46</A></TD>
<TD><A HREF="./47.html">47</A></TD>
<TD><A HREF="./48.html">48</A></TD>
<TD><A HREF="./49.html">49</A></TD>
<TD><A HREF="./50.html">50</A></TD>
<TD><A HREF="./51.html">51</A></TD>
<TD><A HREF="./52.html">52</A></TD>
<TD><A HREF="./53.html">53</A></TD>
<TD><A HREF="./54.html">54</A></TD>
<TD><A HREF="./55.html">55</A></TD>
<TD><A HREF="./56.html">56</A></TD>
<TD><A HREF="./57.html">57</A></TD>
<TD><A HREF="./60.html">60</A></TD>
<TD><A HREF="./61.html">61</A></TD>
<TD><A HREF="./62.html">62</A></TD>
<TD><A HREF="./63.html">63</A></TD>
<TD><A HREF="./64.html">64</A></TD>
<TD><A HREF="./65.html">65</A></TD>
<TD><A HREF="./66.html">66</A></TD>
</tr><tr valign="center" align="center">
<TD><A HREF="./67.html">67</A></TD>
<TD><A HREF="./69.html">69</A></TD>
<TD><A HREF="./72.html">72</A></TD>
<TD><A HREF="./76.html">76</A></TD>
<TD><A HREF="./77.html">77</A></TD>
<TD><A HREF="./78.html">78</A></TD>
<TD><A HREF="./79.html">79</A></TD>
<TD><A HREF="./80.html">80</A></TD>
<TD><A HREF="./81.html">81</A></TD>
<TD><A HREF="./82.html">82</A></TD>
<TD><A HREF="./84.html">84</A></TD>
<TD><A HREF="./85.html">85</A></TD>
<TD><A HREF="./86.html">86</A></TD>
<TD><A HREF="./87.html">87</A></TD>
<TD><A HREF="./91.html">91</A></TD>
<TD><A HREF="./94.html">94</A></TD>
<TD><A HREF="./95.html">95</A></TD>
<TD><A HREF="./96.html">96</A></TD>
<TD><A HREF="./97.html">97</A></TD>
<TD><A HREF="./98.html">98</A></TD>
</tr></table>
</P>
<P> <hr> <P>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<A HREF="../lg_toc36.html"
><IMG SRC="../../gx/indexnew.gif" ALT="[ Table Of Contents ]"></A>
<A HREF="../../index.html"
><IMG SRC="../../gx/homenew.gif" ALT="[ Front Page ]"></A>
<A HREF="../lg_bytes36.html"
><IMG SRC="../../gx/back2.gif" ALT="[ Previous Section ]"></A>
<A HREF="../larriera.html"
><IMG SRC="../../gx/fwd.gif" ALT="[ Next Section ]"></A>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
</BODY></HTML>
<!--endcut ========================================================= -->
|