This file is indexed.

/usr/share/doc/HOWTO/ja-html/Virtual-Services-HOWTO-4.html is in doc-linux-ja-html 2006.05.25-1.1.

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

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE>Virtual Services Howto: ²¾ÁÛ¥¹¥¯¥ê¥×¥È(Virt scripts)</TITLE>
 <LINK HREF="Virtual-Services-HOWTO-5.html" REL=next>
 <LINK HREF="Virtual-Services-HOWTO-3.html" REL=previous>
 <LINK HREF="Virtual-Services-HOWTO.html#toc4" REL=contents>
</HEAD>
<BODY>
<A HREF="Virtual-Services-HOWTO-5.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="Virtual-Services-HOWTO-3.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="Virtual-Services-HOWTO.html#toc4">Ìܼ¡¤Ø</A>
<HR>
<H2><A NAME="s4">4. ²¾ÁÛ¥¹¥¯¥ê¥×¥È(Virt scripts)</A></H2>

<H2><A NAME="ss4.1">4.1 virtfs</A>
</H2>

<P>³Æ¥É¥á¥¤¥ó¤Ï¤½¤ì¤¾¤ì¤Î¥Ç¥£¥ì¥¯¥È¥ê¹½Â¤¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹¡£<CODE> chroot </CODE>¤ò
»È¤Ã¤Æ¤¤¤ë¤Î¤Ç¥·¥§¥¢¥é¥¤¥Ö¥é¥ê(shared libraries), ¥Ð¥¤¥Ê¥ê, conf ¥Õ¥¡¥¤¥ëÅù
¤Î ½ÅÊ£¤·¤¿¥³¥Ô¡¼¤¬É¬Íפˤʤê¤Þ¤¹¡£Ãø¼Ô¤Ï³Æ¥É¥á¥¤¥óÍѤÎ
<CODE>/virtual/domain.com</CODE>¤òºî¤ê¡¢¤½¤ì¤¾¤ì¤Ë¥³¥Ô¡¼¤·¤Æ»È¤Ã¤Æ¤¤¤Þ¤¹¡£
¤½¤Î¤¿¤á¿¤¯¤Î¥Ç¥£¥¹¥¯¥¹¥Ú¡¼¥¹¤ò»È¤¤¤Þ¤¹¤¬¿·¤·¤¤¥Þ¥·¥ó¤ä¥Í¥Ã¥È¥ï¡¼¥¯¥«¡¼¥É
¤ò¹ØÆþ¤¹¤ë¤è¤ê¤Ï°Â²Á¤Ç¤·¤ç¤¦¡£¤â¤·¥Ç¥£¥¹¥¯¥¹¥Ú¡¼¥¹¤òÀáÌó¤·¤¿¤¤¤Î¤Ê¤é
¤½¤ì¤¾¤ì¤Î¥Õ¥¡¥¤¥ë¤ò¥ê¥ó¥¯¤¹¤ì¤Ð´Ö¤Ë¹ç¤¤¤Þ¤¹
(ÌõÃí¡§¤³¤Î¥ê¥ó¥¯¤Ï¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó)¡£
<P> 
¤³¤³¤Çvirtfs¥¹¥¯¥ê¥×¥È¤ÎÎã¤ò¤¢¤²¤Þ¤¹¡£
<P>
<HR>
<PRE>
#!/bin/bash

echo '$Revision: 1.2 $'

echo -n "Enter the domain name: "
read domain

if [ "$domain" = "" ]
then
        echo Nothing entered: aborting
        exit 0
fi

leadingdir=/virtual

echo -n "Enter leading dir: (Enter for default: $leadingdir): "
read ans

if [ "$ans" != "" ]
then
        leadingdir=$ans
fi 

newdir=$leadingdir/$domain

if [ -d "$newdir" ]
then
        echo New directory: $newdir: ALREADY exists
        exit 0
else
        echo New directory: $newdir
fi

echo Create $newdir
mkdir -p $newdir

echo Create bin
cp -pdR /bin $newdir

echo Create dev
cp -pdR /dev $newdir

echo Create dev/log
ln -f /virtual/log $newdir/dev/log

echo Create etc
mkdir -p $newdir/etc
for i in /etc/* 
do 
        if [ -d "$i" ]
        then 
                continue
        fi
        cp -pd $i $newdir/etc
done

echo Create etc/skel
mkdir -p $newdir/etc/skel

echo Create home
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z 
#   (ÌõÃí¡§¤³¤³¤Î[a-z]¤Ï¤½¤ì¤¾¤ìÀßÄꤹ¤ë¥æ¡¼¥¶¡¼Ì¾¤ËÊѹ¹¤·¤Þ¤¹)
do 
        mkdir -p $newdir/home/$i
done

echo Create home/c/crc
mkdir -p $newdir/home/c/crc
chown crc.users $newdir/home/c/crc
#  (ÌõÃí¡§¤³¤³¤âÀßÄꤷ¤¿¥æ¡¼¥¶¡¼¤Ë¹ç¤ï¤»¤ÆÊѹ¹¤·¤Æ²¼¤µ¤¤)

echo Create lib
mkdir -p $newdir/lib
for i in /lib/* 
do 
        if [ -d "$i" ]
        then 
                continue
        fi
        cp -pd $i $newdir/lib
done

echo Create proc
mkdir -p $newdir/proc

echo Create sbin
cp -pdR /sbin $newdir

echo Create tmp
mkdir -p -m 0777 $newdir/tmp
chmod +t $newdir/tmp

echo Create usr
mkdir -p $newdir/usr

echo Create usr/bin
cp -pdR /usr/bin $newdir/usr

echo Create usr/lib
mkdir -p $newdir/usr/lib

echo Create usr/lib/locale
cp -pdR /usr/lib/locale $newdir/usr/lib
#       (ÌõÃí¡§¤³¤³¤Î¥Ç¥£¥ì¥¯¥È¥êŬÅö¤ËÊѹ¹¤·¤Þ¤¹)

echo Create usr/lib/terminfo
cp -pdR /usr/lib/terminfo $newdir/usr/lib

echo Create usr/lib/zoneinfo
cp -pdR /usr/lib/zoneinfo $newdir/usr/lib

echo Create usr/lib/\*.so\*
cp -pdR /usr/lib/*.so* $newdir/usr/lib

echo Create usr/sbin
cp -pdR /usr/sbin $newdir/usr

echo Linking usr/tmp
ln -s /tmp $newdir/usr/tmp

echo Create var
mkdir -p $newdir/var

echo Create var/lock
cp -pdR /var/lock $newdir/var

echo Create var/log
mkdir -p $newdir/var/log

echo Create var/log/wtmp
cp /dev/null $newdir/var/log/wtmp

echo Create var/run
cp -pdR /var/run $newdir/var

echo Create var/run/utmp
cp /dev/null $newdir/var/run/utmp

echo Create var/spool
cp -pdR /var/spool $newdir/var

echo Linking var/tmp
ln -s /tmp $newdir/var/tmp 

echo Create var/www/html
mkdir -p $newdir/var/www/html
chown webmast.www $newdir/var/www/html
#  (ÌõÃí¡§¤³¤³¤Îchown¤âŬÅö¤ËÊѹ¹¤·¤Æ¤ª¤¤¤Æ²¼¤µ¤¤¡£°Ê²¼Æ±ÍÍ)
chmod g+s $newdir/var/www/html

echo Create var/www/master
mkdir -p $newdir/var/www/master
chown webmast.www $newdir/var/www/master

echo Create var/www/server
mkdir -p $newdir/var/www/server
chown webmast.www $newdir/var/www/server

exit 0
</PRE>
<HR>
<P>
<H2><A NAME="ss4.2">4.2 virtexec</A>
</H2>

<P> 
²¾Á۴Ķ­¤Ç¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¤½¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ø<CODE> chroot </CODE>¤·¤Æ¤«¤é
¼Â¹Ô¤·¤Þ¤¹¡£¤³¤³¤Ç¥³¥Þ¥ó¥É¤òÁàºî¤¹¤ëvirtexec¤ò¸Æ¤Ó½Ð¤¹¥·¥§¥ë
¥¹¥¯¥ê¥×¥È¤ò½ñ¤­¤Þ¤·¤¿¡£
(ÌõÃí¡§°Ê²¼¤Î¥³¡¼¥É¤òÀÚ¤ê¼è¤Ã¤Æ<CODE>/usr/bin</CODE>¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥³¥Ô¡¼
¤·¤Þ¤¹¡£Â°À­¤ÎÊѹ¹(<CODE>chmod +x</CODE>)¤ò¤·¤Æ¤ª¤¤¤Æ²¼¤µ¤¤)¡£
<HR>
<PRE>
#!/bin/sh

echo '$Revision: 1.2 $'

BNAME=`basename $0`
FIRST4CHAR=`echo $BNAME | cut -c1-4`
REALBNAME=`echo $BNAME | cut -c5-`

if [ "$BNAME" = "virtexec" ]
then
        echo Cannot run virtexec directly: NEED a symlink
        exit 0
fi

if [ "$FIRST4CHAR" != "virt" ]
then
        echo Symlink not a virt function
        exit 0
fi

list=""
num=1
for i in /virtual/*
do
        if [ ! -d "$i" ]
        then
                continue
        fi
        if [ "$i" = "/virtual/lost+found" ]
        then
                continue
        fi
        list="$list $i $num"
        num=`expr $num + 1`
done

if [ "$list" = "" ]
then
        echo No virtual environments exist
        exit 0
fi

dialog --clear --title 'Virtexec' --menu Pick 20 70 12 $list 2> /tmp/menu.$$
if [ "$?" = "0" ]
then
        newdir=`cat /tmp/menu.$$`
else
        newdir=""
fi
tput clear
rm -f /tmp/menu.$$

echo '$Revision: 1.2 $'

if [ ! -d "$newdir" ]
then
        echo New directory: $newdir: NOT EXIST
        exit 0
else
        echo New directory: $newdir
fi

echo bname: $BNAME

echo realbname: $REALBNAME

if [ "$*" = "" ]
then
        echo args: none
else
        echo args: $*
fi

echo Changing to $newdir
cd $newdir

echo Running program $REALBNAME

chroot $newdir $REALBNAME $*

exit 0
</PRE>
<HR>

¤³¤ì¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï³Æ¼«¤Î¥·¥¹¥Æ¥à¤Ë<CODE> dialog </CODE>¥×¥í¥°¥é¥à¤¬¥¤¥ó¥¹¥È¡¼¥ë
¤µ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£Ãí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£
(<EM>ÌõÃí¡§</EM>dialog = ¥·¥§¥ë¥¹¥¯¥ê¥×¥È¤«¤é¥À¥¤¥¢¥í¥°¥Ü¥Ã¥¯¥¹¤ò³«¤¯
¥³¥Þ¥ó¥É¤Ç¤¹¡£¤Û¤È¤ó¤É¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Þ¤¹)¡£
virtexec¤ò»È¤¦¤¿¤á¤Ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤ò¤Ï¤ê¤Þ¤¹¡£Î㤨¤Ð¡¢
<PRE>
ln -s /usr/bin/virtexec /usr/bin/virtpasswd
ln -s /usr/bin/virtexec /usr/bin/virtvi
ln -s /usr/bin/virtexec /usr/bin/virtpico
ln -s /usr/bin/virtexec /usr/bin/virtemacs
ln -s /usr/bin/virtexec /usr/bin/virtmailq
</PRE>

¤³¤³¤Ç<CODE>virtvi¡¢virtpasswd¡¢virtmailq</CODE>Åù¤ÈÆþÎϤ¹¤ì¤Ð¤½¤ì¤¾¤ìvi¤¬µ¯Æ°¤·¤¿
¤ê¡¢¥æ¡¼¥¶¡¼¤Î¥Ñ¥¹¥ï¡¼¥É¤¬Êѹ¹¤Ç¤­¤¿¤ê¡¢²¾ÁÛ¥·¥¹¥Æ¥à¾å¤Î¥á¡¼¥ë¥­¥å¡¼¤ò
¥Á¥§¥Ã¥¯¤Ç¤­¤¿¤ê¤·¤Þ¤¹¡£É¬Íפ˱þ¤¸¤Æ¤â¤Ã¤È¿¤¯¥ê¥ó¥¯¤ò¤Ï¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£
¤·¤«¤·¥×¥í¥°¥é¥à¤¬¥·¥§¥¢¥é¥¤¥Ö¥é¥ê(shared library)¤òɬÍפȤ¹¤ë¤È¤­¤Ï
²¾ÁÛ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¾å¤Ë¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë¤âƱÍͤË
²¾ÁÛ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¾å¤Ë¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
<P>
<H2><A NAME="ss4.3">4.3 virtfs¤Èvirtexec¤Ë´Ø¤¹¤ëÃí°Õ</A>
</H2>

<P>Ãø¼Ô¤ÏÁ´¤Æ¤Î¥¹¥¯¥ê¥×¥È¤ò/usr/bin¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤¤¤Þ¤¹¡£²¾ÁÛ¥Õ¥¡¥¤¥ë
¥·¥¹¥Æ¥à¾å¤ËÃÖ¤­¤¿¤¯¤Ê¤¤¤â¤Î¤Ï/usr/local¤ËÃÖ¤¤¤Æ¤¤¤Þ¤¹¡£¥¹¥¯¥ê¥×¥È¤Ï
¥³¥Ô¡¼¤Ë´Ø¤·¤Æ¤Ê¤Ë¤â¥¿¥Ã¥Á¤·¤Ê¤¤¤è¤¦¤Ë¤·¤Þ¤¹¡£
²¾ÁÛ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à´Ö¤Ç¤Þ¤¿¤¬¤é¤Ê¤¤¤³¤È¤¬½ÅÍפÊÁ´¤Æ¤Î¥Õ¥¡¥¤¥ë¤Ïºï½ü¤·¤Ê¤¯
¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£
Î㤨¤Ð¡¢Ãø¼Ô¤Î¥·¥¹¥Æ¥à¤Ë¤Ïssh¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¢¥×¥é¥¤¥Ù¡¼¥È¥­¡¼
(private key)¤Ï¤É¤Î²¾ÁÛ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤«¤é¤â¸«¤¨¤ë¤è¤¦¤Ë¤Ï¤·¤¿¤¯¤¢¤ê¤Þ¤»¤ó¡£
¤½¤³¤Çvirtfs¤ò¼Â¹Ô¤·¤¿¸å¤Ë¤½¤ì¤¾¤ì¤Î²¾ÁÛ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤«¤é¥×¥é¥¤¥Ù¡¼¥È¥­¡¼
¤òºï½ü¤·¤Æ¤¤¤Þ¤¹¡£
(<EM>ÌõÃí¡§</EM>ssh¤ÏSecure Shell¤Î¤³¤È¤Ç¤¹¡£<CODE>secure authentication,
encryption, encrypted X11 connections, encrypted TCP/IP forwarding</CODE>
¤ò¤â¤Ã¤¿¥ê¥â¡¼¥È¥í¥°¥¤¥ó¥×¥í¥°¥é¥à¤Ç,ŬÅö¤Ê¥¢¡¼¥«¥¤¥Ö¥µ¡¼¥Ð¤Î
<CODE>archives/net/ssh/</CODE>¥Ç¥£¥ì¥¯¥È¥ê¤Ê¤É¤«¤éÆþ¼ê¤Ç¤­¤Þ¤¹)
<P>¤Þ¤¿resolv.conf(ÌõÃí¡§ DNS¾ðÊó¤Ê¤É <CODE>/etc/resolv.conf</CODE>) ¤âÊѹ¹¤·
¾¤Î¥É¥á¥¤¥ó̾¤¬¤¢¤ë¥Õ¥¡¥¤¥ë¤ÏÁ´¤Æ°ÜÆ°¤·¤Æ¤¤¤Þ¤¹¡£Î㤨¤Ð
<CODE>/etc/hosts</CODE> ¤ä <CODE>/etc/HOSTNAME</CODE>¤Ê¤É¤Ç¤¹¡£
<P>
<P>virtexec¤Ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤ò¤Ï¤Ã¤Æ¤¤¤ë¥×¥í¥°¥é¥à¤Ï
<UL>
<LI> virtpasswd -- ¥Ñ¥¹¥ï¡¼¥ÉÊѹ¹</LI>
<LI> virtadduser -- ¥æ¡¼¥¶¡¼ÄɲÃ</LI>
<LI> virtdeluser -- ¥æ¡¼¥¶¡¼ºï½ü</LI>
<LI> virtsmbstatus -- samba status  </LI>
<LI> virtvi -- ¥Õ¥¡¥¤¥ë¤ÎÊÔ½¸</LI>
<LI> virtmailq -- mailq¤Î¥Á¥§¥Ã¥¯      </LI>
<LI> virtnewaliases -- ¥¨¥¤¥ê¥¢¥¹¥Æ¡¼¥Ö¥ëºÆ¹½ÃÛ</LI>
</UL>

¤Ç¤¹¡£
<P>
<P>
<HR>
<A HREF="Virtual-Services-HOWTO-5.html">¼¡¤Î¥Ú¡¼¥¸</A>
<A HREF="Virtual-Services-HOWTO-3.html">Á°¤Î¥Ú¡¼¥¸</A>
<A HREF="Virtual-Services-HOWTO.html#toc4">Ìܼ¡¤Ø</A>
</BODY>
</HTML>