These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX03/Build Contents Of Bin

Classnotes | UNIX03 | RecentChanges | Preferences

We now build the contents of the ~/bin directory, again much like we did with Amavisd.

  • NOTE: If you cannot see the directory contents after you login as the guest user, the 'ls' program that you installed is not working. If you use an 'ls' linked for dynamic libraries, and you do not have the required libraries and/or devices installed properly in the guest tree, 'ls' will not work and you will not see the contents of the guest directory.

Another problem that has been reported is that the chroot() directory given in your /etc/passwd file for the guest account must be to the directory where your ~/bin directory is located. That is, if your chroot directory is /u01/ftp/ftptest/ and your /etc/passwd account is

 yourftp:x:42:42:guest ftp account:/u01/ftp/./ftptest:/etc/ftponly 

it will not work, as the ~/bin directory is not under the chroot()ed directory. It must be set as follows.

 yourftp:x:42:42:guest ftp account:/u01/ftp/ftptest/./:/etc/ftponly 

There are additional resources to help if you still cannot see files after an FTP login. See the FAQ and Resource Center and http://www.wuftpd.org/ for more information.

 cp /.../bin/ls bin 
 chown root.bin bin/ls 
 chmod 111 bin/ls 

Optional for on the fly compression and tar:

 cp /.../bin/gzip bin 
 cp /.../bin/tar bin 
 chown root.bin bin/gzip 
 chown root.bin bin/tar 
 chmod 111 bin/gzip 
 chmod 111 bin/tar 

If the utilities are not static, create the necessary devices in ~/dev and copy the necessary libraries into ~/lib. Check the man page for ftpd that comes with your system; it may be of help.

A quick way to do it, is to execute the following for each binary file you just copied

 # for i in `ldd /bin/ls | sed 's/.*=> //' | sed 's/(.*//'`; do 
 > cp $i /home/web/mort$i; 
 > done

replacing "/bin/ls" with "/bin/gzip", "/bin/tar", etc as needed.

===REGARDING HARD AND SOFT/SYMBOLIC LINKS:===

The chroot() obviates the use of soft links in this case. However, it it is possible to make these hard links back to the master copy of the utilities rather than copies. This can save some disk space if that is a concern, but do not do it in this case.



Classnotes | UNIX03 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited June 14, 2003 3:21 am (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.