wu-ftpd 2.4.2 beta18-vr14 インストールログ [準備] wu-ftpd-2.4.2-beta-18-vr14.tar.gz 1. 展開 tar zxvf wu-ftpd-2.4.2-beta-18-vr14.tar.gz 2. 設定の変更 ftpd 本体を /usr/local/ftpd に man を /usr/local/man に、 設定ファイルを /usr/local/etc に置くために、 makefiles/Makefile.sol を編集。変更箇所は先頭の3行。 BINDIR= /usr/local/ftpd ETCDIR= /usr/local/etc MANDIR= /usr/local/man また src/config/config.sol を変更。変更箇所は1箇所 #define USE_LOCAL_ETC 3. make ./build CC=gcc sol 4. インストール ./build install 5. anonymous FTP の設定 5a. ユーザ ftp の登録 /etc/passwd に(必要なら /etc/shadow にも)登録。 ftp:x:500:25:Anonymous FTP user:/center/ftp:/bin/false (/center/ftp が anonymous FTP のルートディレクトリになる) 5b. inetd.conf に登録 デフォルトの ftp の行をコメントアウトし、次の行を追加。 ftp stream tcp nowait root /usr/local/ftpd/in.ftpd in.ftpd -a 5c. anonymous FTP のディレクトリの準備 /center/ftp 以下に次のディレクトリを準備 dr-xr-xr-x 2 root other 512 2月 17日 23:30 bin/ dr-xr-xr-x 2 root other 512 2月 15日 15:29 dev/ dr-xr-xr-x 3 root other 512 2月 15日 16:02 etc/ dr-xr-xr-x 2 root other 512 2月 15日 15:53 msg/ dr-xr-xr-x 6 ftp other 512 2月 19日 17:15 pub/ dr-xr-xr-x 5 root other 512 2月 15日 15:31 usr/ bin は usr/bin へのシンボリックリンクでよい。dev にはいくつかの デバイスを準備。 crw-rw-rw- 1 ftp other 11, 42 2月 10日 20:22 tcp crw-rw-rw- 1 root other 105, 1 2月 15日 15:29 ticotsord crw-rw-rw- 1 root other 11, 41 2月 15日 15:29 udp crw-rw-rw- 1 ftp other 13, 12 2月 10日 20:22 zero 本来の/dev ディレクトリを参考にmknod コマンドで作成する。 (最低限 tcp と zero があればいいらしい) etc ディレクトリには最低限の passwd と group ファイルを準備。 dr-xr-xr-x 2 root other 512 2月 15日 15:47 default/ -r--r--r-- 1 root other 36 2月 15日 15:24 group -r--r--r-- 1 root other 1064 2月 15日 15:24 netconfig -r--r--r-- 1 root other 774 2月 17日 11:35 nsswitch.conf -r--r--r-- 1 root other 109 2月 15日 15:24 passwd Solaris の場合 netconfig も nsswitch.conf も必要らしい。 default 以下には元の/etc/default/init をコピー。 usr 以下には次のディレクトリを準備。 dr-xr-xr-x 2 root other 512 2月 17日 23:31 bin/ dr-xr-xr-x 2 root other 512 2月 17日 16:43 lib/ dr-xr-xr-x 3 root other 512 2月 15日 15:31 share/ lib 以下には bin のコマンドが参照する共有ライブラリが必要。 -r-xr-xr-x 1 ftp other 155060 2月 12日 19:59 ld.so.1* -r-xr-xr-x 1 ftp other 1013248 2月 12日 20:00 libc.so.1* -r-xr-xr-x 1 ftp other 4284 2月 12日 20:00 libdl.so.1* -r-xr-xr-x 1 root other 2468 2月 17日 11:35 libintl.so.1* -r-xr-xr-x 1 ftp other 6732 2月 12日 20:01 libmp.so.1* -r-xr-xr-x 1 ftp other 718700 2月 12日 20:01 libnsl.so.1* -r-xr-xr-x 1 ftp other 53656 2月 12日 20:01 libsocket.so.1* -r-xr-xr-x 1 root other 6708 2月 17日 11:35 libw.so.1* -r-xr-xr-x 1 root other 56216 2月 15日 15:22 libxfn.so.1* -r-xr-xr-x 1 ftp other 17128 2月 12日 20:03 nss_compat.so.1* -r-xr-xr-x 1 ftp other 9804 2月 12日 20:03 nss_dns.so.1* -r-xr-xr-x 1 ftp other 27000 2月 12日 20:03 nss_files.so.1* -r-xr-xr-x 1 ftp other 30348 2月 12日 20:02 nss_nis.so.1* -r-xr-xr-x 1 ftp other 36004 2月 12日 20:02 nss_nisplus.so.1* -r-xr-xr-x 1 ftp other 10696 2月 12日 20:04 straddr.so* -r-xr-xr-x 1 ftp other 10696 2月 12日 20:04 straddr.so.2* 今回は次節で触れるスタティックリンク版の ls を入れたので必要なかった かもしれない。 usr/share には lib/zoneinfo をコピー。 usr/bin には ls を入れる(次節) 5d. ls の準備 普通は標準の ls をコピーすればいいはずだが、今回はこれではどうしても anonymous FTP した時にユーザ名やグループ名が表示されない(ユーザ番号や グループ番号しか出ない)現象が見られたためスタティックリンクした ls を 準備した。 GNU のサイトから fileutils-3.16.tar.gz を取ってきて展開する。 次の文書に従ってパッチを当て、ファイルを追加する。 ----- ここから ------------------------------------------------- Message-Id: <33432400.784030356@mail.co.telenet.pt> Date: Wed, 26 Mar 1997 13:32:59 GMT Reply-To: wu-ftpd@wugate.wustl.edu Sender: owner-wu-ftpd@wugate.wustl.edu From: melo@co.telenet.pt (Pedro Melo) To: wu-ftpd@wugate.wustl.edu Cc: minerva@teleport.com Subject: Static-ls for fileutils 3-16 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: Forte Agent 1.0/32.390 X-Listprocessor-Version: 8.0 -- ListProcessor(tm) by CREN Content-Type: text/plain; charset=us-ascii Content-Length: 8010 Hi! I have made a small procedure for compiling ls static on Solaris. Tested on Solaris 2.5.1 with gcc and fileutils-3.16 Basically I adapted the current procedure to the new fileutils (old one was for fileutils-3.13) and use the same static-ls.c from Emil. It might be good to put it online so I'm CC'ing this to Darci who maintains the HowTo for WuFtpd on Solaris Melo -------------- Ok, a small procedure to build a staitc ls. 1. get fileutils-3.16 from your favourite GNU mirror site. 2. Unpack 3. apply the patch (see below) 4. copy static-ls.c (see below) to the fileutils-3.16/src/ subdirectory. static-ls contains some the functions that Solaris does not provide statically. This file is the work of Emil Isberg and Brett Porter . Great work! 5. cd into fileutils-3.16 6. run configure 7. make 8. cd into src 9. test with truss ./ls -la 2> err err should not contain any references to any libs... file ls should report somethink like ELF 32-bit MSB executable SPARC Version 1, statically linked, not stripped 10. (Optional) strip ls You can now copy it into your bin directory. Files needed. ---------cut here: ls-static.patch------------ *** fileutils-3.16/src/Makefile.in Mon Jan 27 02:26:57 1997 --- fileutils-3.16-prep/src/Makefile.in Wed Mar 26 12:56:16 1997 *************** *** 74,79 **** --- 74,80 ---- cp_SOURCES = cp.c cp-aux.c cp-hash.c dir_SOURCES = ls.c ls-dir.c vdir_SOURCES = ls.c ls-vdir.c + static-ls_SOURCES = static-ls.c ls_SOURCES = ls.c ls-ls.c BUILT_SOURCES = dircolors.h *************** *** 155,164 **** vdir_LDADD = $(LDADD) vdir_DEPENDENCIES = ../lib/libfu.a vdir_LDFLAGS = ! ls_OBJECTS = ls.$o ls-ls.$o ls_LDADD = $(LDADD) ls_DEPENDENCIES = ../lib/libfu.a ! ls_LDFLAGS = mkdir_SOURCES = mkdir.c mkdir_OBJECTS = mkdir.$o mkdir_LDADD = $(LDADD) --- 156,166 ---- vdir_LDADD = $(LDADD) vdir_DEPENDENCIES = ../lib/libfu.a vdir_LDFLAGS = ! static-ls_OBJECTS = static-ls.$o ! ls_OBJECTS = ls.$o ls-ls.$o $(static-ls_OBJECTS) ls_LDADD = $(LDADD) ls_DEPENDENCIES = ../lib/libfu.a ! ls_LDFLAGS = -static mkdir_SOURCES = mkdir.c mkdir_OBJECTS = mkdir.$o mkdir_LDADD = $(LDADD) *************** *** 199,205 **** touch_LDADD = $(LDADD) touch_DEPENDENCIES = ../lib/libfu.a touch_LDFLAGS = ! CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) LINK = $(CC) $(LDFLAGS) -o $@ HEADERS = $(noinst_HEADERS) --- 201,207 ---- touch_LDADD = $(LDADD) touch_DEPENDENCIES = ../lib/libfu.a touch_LDFLAGS = ! CFLAGS = -static @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) LINK = $(CC) $(LDFLAGS) -o $@ HEADERS = $(noinst_HEADERS) ----------- cut here --------------------------- ----------- cut here: static-ls.c -------------- /* static-ls.c rec.1, by Emil Isberg */ /* static-ls.c rev.2, by Brett Porter */ /* static-ls.c rev.2.1, by Emil Isberg */ /* for gnufileutils .. under Solaris 2.5 */ /* To compile .. get the lates version of gnufileutil .. */ /* add this file */ #include #include #include #include #include #include #include #include #include #define FPASSWD "/etc/passwd" #define FGROUP "/etc/group" char *dlopen() { return 0;} int dlclose() { return 0;} char *dlsym() { return 0;} char *dlerror() { return "dynamic linking not loaded";} typedef struct { uid_t uid; char *user_name; } pw_entry; typedef struct { gid_t gid; char *group_name; } group_entry; static pw_entry *pw_array = NULL; static group_entry *group_array = NULL; static void fill_pw_array (void); static void fill_group_array (void); static void fill_pw_array (void) { int fd; int ok; static char *pw_buf; struct stat statbuf; char *cp; int n_entries; int n_read; int entry; fd = open (FPASSWD, O_RDONLY); if (fd < 0) { fprintf (stderr, "Error opening password file.\n"); return; } ok = fstat (fd, &statbuf); if (ok != 0) { fprintf (stderr, "Error stat-ing passwd file.\n"); close (fd); return; } pw_buf = malloc (statbuf.st_size + 1); if (pw_buf == NULL) { fprintf (stderr, "Error allocating memory.\n"); close (fd); return; } n_read = read (fd, pw_buf, (size_t) statbuf.st_size); if (n_read != statbuf.st_size) { perror (NULL); fprintf (stderr, "Error reading password file.\n"); free (pw_buf); close (fd); return; } pw_buf [statbuf.st_size] = '\0'; close (fd); n_entries = 0; for (cp = pw_buf; *cp != '\0'; cp++) { if (*cp == '\n') n_entries++; } pw_array = (pw_entry *) malloc ((n_entries + 1) * sizeof (pw_entry)); if (pw_array == NULL) { fprintf (stderr, "Error allocating memory.\n"); free (pw_buf); return; } pw_array [n_entries].uid = -1; cp = pw_buf; for (entry = 0; entry < n_entries; entry++) { pw_array [entry].user_name = cp; while (*cp != ':') cp++; *cp++ = '\0'; while (*cp != ':') cp++; cp++; pw_array [entry].uid = atoi (cp); while (*cp != '\n') cp++; cp++; } } static void fill_group_array (void) { int fd; int ok; static char *group_buf; struct stat statbuf; char *cp; int n_entries; int n_read; int entry; fd = open (FGROUP, O_RDONLY); if (fd < 0) { fprintf (stderr, "Error opening group file.\n"); return; } ok = fstat (fd, &statbuf); if (ok != 0) { fprintf (stderr, "Error stat-ing group file.\n"); close (fd); return; } group_buf = malloc (statbuf.st_size + 1); if (group_buf == NULL) { fprintf (stderr, "Error allocating memory.\n"); close (fd); return; } n_read = read (fd, group_buf, (size_t) statbuf.st_size); if (n_read != statbuf.st_size) { perror (NULL); fprintf (stderr, "Error reading group file.\n"); free (group_buf); close (fd); return; } group_buf [statbuf.st_size] = '\0'; close (fd); n_entries = 0; for (cp = group_buf; *cp != '\0'; cp++) { if (*cp == '\n') n_entries++; } group_array = (group_entry *) malloc ((n_entries + 1) * sizeof (group_entry)); if (group_array == NULL) { fprintf (stderr, "Error allocating memory.\n"); free (group_buf); return; } group_array [n_entries].gid = -1; cp = group_buf; for (entry = 0; entry < n_entries; entry++) { group_array [entry].group_name = cp; while (*cp != ':') cp++; *cp++ = '\0'; while (*cp != ':') cp++; cp++; group_array [entry].gid = atoi (cp); while (*cp != '\n') cp++; cp++; } } char * getuser(uid_t uid) { pw_entry *p_pw; static char uid_str [11]; if (pw_array == NULL) fill_pw_array (); if (pw_array == NULL) { sprintf (uid_str, "%lu", uid); return uid_str; } for (p_pw = pw_array; p_pw->uid != -1; p_pw++) { if (p_pw->uid == uid) return p_pw->user_name; } sprintf (uid_str, "%lu", uid); return uid_str; } char * getgroup(gid_t gid) { group_entry *p_group; static char gid_str [11]; if (group_array == NULL) fill_group_array (); if (group_array == NULL) { sprintf (gid_str, "%lu", gid); return gid_str; } for (p_group = group_array; p_group->gid != -1; p_group++) { if (p_group->gid == gid) return p_group->group_name; } sprintf (gid_str, "%lu", gid); return gid_str; } ------------------ cut here -------------------- -- ************** Pedro Melo (melo@co.telenet.pt) BOFH ****************** * TELENET, Servicos de Telecomunicacoes, SA - Tel +351 1 3139190 * * finger melo@finger.co.telenet.pt or search key servers for PGP key * * It's management's job to support the geniuses, * * not to tell them what to do * ********************************************************************** ----- ここまで --------------------------------------------------- あとは通常どおり ./configure; make で ls が作成される。 これを usr/bin に置く。 5e. pub 以下にコンテンツを準備する。 5f. /usr/local/etc/ftpaccess で設定。 ------------------------------------------------------ class all real,guest,anonymous * limit all 10 Any /center/ftp/msg/msg.dead passwd-check rfc822 enforce readme README* login readme README* cwd=* message /welcome.msg login message .message cwd=* compress yes all tar yes all log commands real log transfers anonymous,real inbound,outbound shutdown /center/ftp/msg/shutmsg email ftp-adm@fukuoka-edu.ac.jp ------------------------------------------------------------- 5g. 細かい設定 あとの細かい設定(ファイルのパーミッションとか)は参考書などを 参考のこと。